OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/child/resource_dispatcher.h" | 7 #include "content/child/resource_dispatcher.h" |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 base::TimeTicks::Now() - time_start); | 444 base::TimeTicks::Now() - time_start); |
445 } | 445 } |
446 | 446 |
447 // Acknowledge the reception of this data. | 447 // Acknowledge the reception of this data. |
448 message_sender()->Send( | 448 message_sender()->Send( |
449 new ResourceHostMsg_DataReceived_ACK(message.routing_id(), request_id)); | 449 new ResourceHostMsg_DataReceived_ACK(message.routing_id(), request_id)); |
450 } | 450 } |
451 | 451 |
452 void ResourceDispatcher::OnDownloadedData(const IPC::Message& message, | 452 void ResourceDispatcher::OnDownloadedData(const IPC::Message& message, |
453 int request_id, | 453 int request_id, |
454 int data_len) { | 454 int data_len, |
| 455 int encoded_data_length) { |
455 // Acknowledge the reception of this message. | 456 // Acknowledge the reception of this message. |
456 message_sender()->Send( | 457 message_sender()->Send( |
457 new ResourceHostMsg_DataDownloaded_ACK(message.routing_id(), request_id)); | 458 new ResourceHostMsg_DataDownloaded_ACK(message.routing_id(), request_id)); |
458 | 459 |
459 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 460 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
460 if (!request_info) | 461 if (!request_info) |
461 return; | 462 return; |
462 | 463 |
463 request_info->peer->OnDownloadedData(data_len); | 464 request_info->peer->OnDownloadedData(data_len, encoded_data_length); |
464 } | 465 } |
465 | 466 |
466 void ResourceDispatcher::OnReceivedRedirect( | 467 void ResourceDispatcher::OnReceivedRedirect( |
467 const IPC::Message& message, | 468 const IPC::Message& message, |
468 int request_id, | 469 int request_id, |
469 const GURL& new_url, | 470 const GURL& new_url, |
470 const ResourceResponseHead& response_head) { | 471 const ResourceResponseHead& response_head) { |
471 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); | 472 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
472 if (!request_info) | 473 if (!request_info) |
473 return; | 474 return; |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 794 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
794 while (!queue->empty()) { | 795 while (!queue->empty()) { |
795 IPC::Message* message = queue->front(); | 796 IPC::Message* message = queue->front(); |
796 ReleaseResourcesInDataMessage(*message); | 797 ReleaseResourcesInDataMessage(*message); |
797 queue->pop_front(); | 798 queue->pop_front(); |
798 delete message; | 799 delete message; |
799 } | 800 } |
800 } | 801 } |
801 | 802 |
802 } // namespace content | 803 } // namespace content |
OLD | NEW |