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 <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // Normally, dispatching this message causes the reference-counted request to | 368 // Normally, dispatching this message causes the reference-counted request to |
369 // die immediately. | 369 // die immediately. |
370 // TODO(kinuko): Revisit here. This probably needs to call request_info->peer | 370 // TODO(kinuko): Revisit here. This probably needs to call request_info->peer |
371 // but the past attempt to change it seems to have caused crashes. | 371 // but the past attempt to change it seems to have caused crashes. |
372 // (crbug.com/547047) | 372 // (crbug.com/547047) |
373 peer->OnCompletedRequest(request_complete_data.error_code, | 373 peer->OnCompletedRequest(request_complete_data.error_code, |
374 request_complete_data.was_ignored_by_handler, | 374 request_complete_data.was_ignored_by_handler, |
375 request_complete_data.exists_in_cache, | 375 request_complete_data.exists_in_cache, |
376 renderer_completion_time, | 376 renderer_completion_time, |
377 request_complete_data.encoded_data_length, | 377 request_complete_data.encoded_data_length, |
378 request_complete_data.encoded_body_length); | 378 request_complete_data.encoded_body_length, |
| 379 request_complete_data.decoded_body_length); |
379 } | 380 } |
380 | 381 |
381 bool ResourceDispatcher::RemovePendingRequest(int request_id) { | 382 bool ResourceDispatcher::RemovePendingRequest(int request_id) { |
382 PendingRequestMap::iterator it = pending_requests_.find(request_id); | 383 PendingRequestMap::iterator it = pending_requests_.find(request_id); |
383 if (it == pending_requests_.end()) | 384 if (it == pending_requests_.end()) |
384 return false; | 385 return false; |
385 | 386 |
386 PendingRequestInfo* request_info = it->second.get(); | 387 PendingRequestInfo* request_info = it->second.get(); |
387 | 388 |
388 // |url_loader_client| releases the downloaded file. Otherwise (i.e., we | 389 // |url_loader_client| releases the downloaded file. Otherwise (i.e., we |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 775 |
775 // Call OnComplete now too, as it won't get called on the client. | 776 // Call OnComplete now too, as it won't get called on the client. |
776 // TODO(kinuko): Fill this properly. | 777 // TODO(kinuko): Fill this properly. |
777 ResourceRequestCompletionStatus completion_status; | 778 ResourceRequestCompletionStatus completion_status; |
778 completion_status.error_code = net::OK; | 779 completion_status.error_code = net::OK; |
779 completion_status.was_ignored_by_handler = false; | 780 completion_status.was_ignored_by_handler = false; |
780 completion_status.exists_in_cache = false; | 781 completion_status.exists_in_cache = false; |
781 completion_status.completion_time = base::TimeTicks::Now(); | 782 completion_status.completion_time = base::TimeTicks::Now(); |
782 completion_status.encoded_data_length = -1; | 783 completion_status.encoded_data_length = -1; |
783 completion_status.encoded_body_length = -1; | 784 completion_status.encoded_body_length = -1; |
| 785 completion_status.decoded_body_length = -1; |
784 client_ptr->OnComplete(completion_status); | 786 client_ptr->OnComplete(completion_status); |
785 } | 787 } |
786 | 788 |
787 // static | 789 // static |
788 bool ResourceDispatcher::IsResourceDispatcherMessage( | 790 bool ResourceDispatcher::IsResourceDispatcherMessage( |
789 const IPC::Message& message) { | 791 const IPC::Message& message) { |
790 switch (message.type()) { | 792 switch (message.type()) { |
791 case ResourceMsg_UploadProgress::ID: | 793 case ResourceMsg_UploadProgress::ID: |
792 case ResourceMsg_ReceivedResponse::ID: | 794 case ResourceMsg_ReceivedResponse::ID: |
793 case ResourceMsg_ReceivedCachedMetadata::ID: | 795 case ResourceMsg_ReceivedCachedMetadata::ID: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 delete message; | 839 delete message; |
838 } | 840 } |
839 } | 841 } |
840 | 842 |
841 void ResourceDispatcher::SetResourceSchedulingFilter( | 843 void ResourceDispatcher::SetResourceSchedulingFilter( |
842 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { | 844 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter) { |
843 resource_scheduling_filter_ = resource_scheduling_filter; | 845 resource_scheduling_filter_ = resource_scheduling_filter; |
844 } | 846 } |
845 | 847 |
846 } // namespace content | 848 } // namespace content |
OLD | NEW |