| 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/browser/renderer_host/resource_dispatcher_host_impl.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 bool handled = true; | 666 bool handled = true; |
| 667 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHostImpl, message, *message_was_ok) | 667 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHostImpl, message, *message_was_ok) |
| 668 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) | 668 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) |
| 669 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) | 669 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) |
| 670 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, | 670 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, |
| 671 OnReleaseDownloadedFile) | 671 OnReleaseDownloadedFile) |
| 672 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) | 672 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) |
| 673 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) | 673 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) |
| 674 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) | 674 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) |
| 675 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) | 675 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) |
| 676 IPC_MESSAGE_HANDLER(ResourceHostMsg_TransferRequestToNewPage, | |
| 677 OnTransferRequestToNewPage) | |
| 678 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) | 676 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) |
| 679 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) | 677 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) |
| 680 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 678 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
| 681 OnDidLoadResourceFromMemoryCache) | 679 OnDidLoadResourceFromMemoryCache) |
| 682 IPC_MESSAGE_UNHANDLED(handled = false) | 680 IPC_MESSAGE_UNHANDLED(handled = false) |
| 683 IPC_END_MESSAGE_MAP_EX() | 681 IPC_END_MESSAGE_MAP_EX() |
| 684 | 682 |
| 685 if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { | 683 if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { |
| 686 // We just needed to peek at this message. We still want it to reach its | 684 // We just needed to peek at this message. We still want it to reach its |
| 687 // normal destination. | 685 // normal destination. |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 | 1040 |
| 1043 ResourceRequestInfoImpl* info = | 1041 ResourceRequestInfoImpl* info = |
| 1044 ResourceRequestInfoImpl::ForRequest(i->second); | 1042 ResourceRequestInfoImpl::ForRequest(i->second); |
| 1045 info->set_waiting_for_upload_progress_ack(false); | 1043 info->set_waiting_for_upload_progress_ack(false); |
| 1046 } | 1044 } |
| 1047 | 1045 |
| 1048 void ResourceDispatcherHostImpl::OnCancelRequest(int request_id) { | 1046 void ResourceDispatcherHostImpl::OnCancelRequest(int request_id) { |
| 1049 CancelRequest(filter_->child_id(), request_id, true); | 1047 CancelRequest(filter_->child_id(), request_id, true); |
| 1050 } | 1048 } |
| 1051 | 1049 |
| 1052 // Assigns the pending request a new routing_id because it was transferred | |
| 1053 // to a new page. | |
| 1054 void ResourceDispatcherHostImpl::OnTransferRequestToNewPage(int new_routing_id, | |
| 1055 int request_id) { | |
| 1056 PendingRequestList::iterator i = pending_requests_.find( | |
| 1057 GlobalRequestID(filter_->child_id(), request_id)); | |
| 1058 if (i == pending_requests_.end()) { | |
| 1059 // We probably want to remove this warning eventually, but I wanted to be | |
| 1060 // able to notice when this happens during initial development since it | |
| 1061 // should be rare and may indicate a bug. | |
| 1062 DVLOG(1) << "Updating a request that wasn't found"; | |
| 1063 return; | |
| 1064 } | |
| 1065 net::URLRequest* request = i->second; | |
| 1066 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | |
| 1067 info->set_route_id(new_routing_id); | |
| 1068 } | |
| 1069 | |
| 1070 void ResourceDispatcherHostImpl::OnFollowRedirect( | 1050 void ResourceDispatcherHostImpl::OnFollowRedirect( |
| 1071 int request_id, | 1051 int request_id, |
| 1072 bool has_new_first_party_for_cookies, | 1052 bool has_new_first_party_for_cookies, |
| 1073 const GURL& new_first_party_for_cookies) { | 1053 const GURL& new_first_party_for_cookies) { |
| 1074 FollowDeferredRedirect(filter_->child_id(), request_id, | 1054 FollowDeferredRedirect(filter_->child_id(), request_id, |
| 1075 has_new_first_party_for_cookies, | 1055 has_new_first_party_for_cookies, |
| 1076 new_first_party_for_cookies); | 1056 new_first_party_for_cookies); |
| 1077 } | 1057 } |
| 1078 | 1058 |
| 1079 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( | 1059 ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2359 return allow_cross_origin_auth_prompt_; | 2339 return allow_cross_origin_auth_prompt_; |
| 2360 } | 2340 } |
| 2361 | 2341 |
| 2362 bool ResourceDispatcherHostImpl::IsTransferredNavigation( | 2342 bool ResourceDispatcherHostImpl::IsTransferredNavigation( |
| 2363 const GlobalRequestID& transferred_request_id) const { | 2343 const GlobalRequestID& transferred_request_id) const { |
| 2364 return transferred_navigations_.find(transferred_request_id) != | 2344 return transferred_navigations_.find(transferred_request_id) != |
| 2365 transferred_navigations_.end(); | 2345 transferred_navigations_.end(); |
| 2366 } | 2346 } |
| 2367 | 2347 |
| 2368 } // namespace content | 2348 } // namespace content |
| OLD | NEW |