| 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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 // die immediately. | 567 // die immediately. |
| 568 peer->OnCompletedRequest(request_complete_data.error_code, | 568 peer->OnCompletedRequest(request_complete_data.error_code, |
| 569 request_complete_data.was_ignored_by_handler, | 569 request_complete_data.was_ignored_by_handler, |
| 570 request_complete_data.exists_in_cache, | 570 request_complete_data.exists_in_cache, |
| 571 request_complete_data.security_info, | 571 request_complete_data.security_info, |
| 572 renderer_completion_time, | 572 renderer_completion_time, |
| 573 request_complete_data.encoded_data_length); | 573 request_complete_data.encoded_data_length); |
| 574 } | 574 } |
| 575 | 575 |
| 576 int ResourceDispatcher::AddPendingRequest(RequestPeer* callback, | 576 int ResourceDispatcher::AddPendingRequest(RequestPeer* callback, |
| 577 ResourceType::Type resource_type, | 577 ResourceType resource_type, |
| 578 int origin_pid, | 578 int origin_pid, |
| 579 const GURL& frame_origin, | 579 const GURL& frame_origin, |
| 580 const GURL& request_url, | 580 const GURL& request_url, |
| 581 bool download_to_file) { | 581 bool download_to_file) { |
| 582 // Compute a unique request_id for this renderer process. | 582 // Compute a unique request_id for this renderer process. |
| 583 int id = MakeRequestID(); | 583 int id = MakeRequestID(); |
| 584 pending_requests_[id] = PendingRequestInfo(callback, | 584 pending_requests_[id] = PendingRequestInfo(callback, |
| 585 resource_type, | 585 resource_type, |
| 586 origin_pid, | 586 origin_pid, |
| 587 frame_origin, | 587 frame_origin, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 request_info->buffer_size); | 665 request_info->buffer_size); |
| 666 return true; | 666 return true; |
| 667 } | 667 } |
| 668 | 668 |
| 669 return false; | 669 return false; |
| 670 } | 670 } |
| 671 | 671 |
| 672 ResourceDispatcher::PendingRequestInfo::PendingRequestInfo() | 672 ResourceDispatcher::PendingRequestInfo::PendingRequestInfo() |
| 673 : peer(NULL), | 673 : peer(NULL), |
| 674 threaded_data_provider(NULL), | 674 threaded_data_provider(NULL), |
| 675 resource_type(ResourceType::SUB_RESOURCE), | 675 resource_type(RESOURCE_TYPE_SUB_RESOURCE), |
| 676 is_deferred(false), | 676 is_deferred(false), |
| 677 download_to_file(false), | 677 download_to_file(false), |
| 678 blocked_response(false), | 678 blocked_response(false), |
| 679 buffer_size(0) { | 679 buffer_size(0) { |
| 680 } | 680 } |
| 681 | 681 |
| 682 ResourceDispatcher::PendingRequestInfo::PendingRequestInfo( | 682 ResourceDispatcher::PendingRequestInfo::PendingRequestInfo( |
| 683 RequestPeer* peer, | 683 RequestPeer* peer, |
| 684 ResourceType::Type resource_type, | 684 ResourceType resource_type, |
| 685 int origin_pid, | 685 int origin_pid, |
| 686 const GURL& frame_origin, | 686 const GURL& frame_origin, |
| 687 const GURL& request_url, | 687 const GURL& request_url, |
| 688 bool download_to_file) | 688 bool download_to_file) |
| 689 : peer(peer), | 689 : peer(peer), |
| 690 threaded_data_provider(NULL), | 690 threaded_data_provider(NULL), |
| 691 resource_type(resource_type), | 691 resource_type(resource_type), |
| 692 origin_pid(origin_pid), | 692 origin_pid(origin_pid), |
| 693 is_deferred(false), | 693 is_deferred(false), |
| 694 url(request_url), | 694 url(request_url), |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 859 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
| 860 while (!queue->empty()) { | 860 while (!queue->empty()) { |
| 861 IPC::Message* message = queue->front(); | 861 IPC::Message* message = queue->front(); |
| 862 ReleaseResourcesInDataMessage(*message); | 862 ReleaseResourcesInDataMessage(*message); |
| 863 queue->pop_front(); | 863 queue->pop_front(); |
| 864 delete message; | 864 delete message; |
| 865 } | 865 } |
| 866 } | 866 } |
| 867 | 867 |
| 868 } // namespace content | 868 } // namespace content |
| OLD | NEW |