OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 bool handled = true; | 338 bool handled = true; |
339 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHost, message, *message_was_ok) | 339 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHost, message, *message_was_ok) |
340 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) | 340 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) |
341 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) | 341 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) |
342 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, | 342 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, |
343 OnReleaseDownloadedFile) | 343 OnReleaseDownloadedFile) |
344 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) | 344 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) |
345 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) | 345 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) |
346 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) | 346 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) |
347 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) | 347 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) |
| 348 IPC_MESSAGE_HANDLER(ResourceHostMsg_TransferRequestToNewPage, |
| 349 OnTransferRequestToNewPage) |
348 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) | 350 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) |
349 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) | 351 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) |
350 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 352 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
351 OnDidLoadResourceFromMemoryCache) | 353 OnDidLoadResourceFromMemoryCache) |
352 IPC_MESSAGE_UNHANDLED(handled = false) | 354 IPC_MESSAGE_UNHANDLED(handled = false) |
353 IPC_END_MESSAGE_MAP_EX() | 355 IPC_END_MESSAGE_MAP_EX() |
354 | 356 |
355 if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { | 357 if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { |
356 // We just needed to peek at this message. We still want it to reach its | 358 // We just needed to peek at this message. We still want it to reach its |
357 // normal destination. | 359 // normal destination. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 return; | 636 return; |
635 | 637 |
636 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); | 638 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); |
637 info->set_waiting_for_upload_progress_ack(false); | 639 info->set_waiting_for_upload_progress_ack(false); |
638 } | 640 } |
639 | 641 |
640 void ResourceDispatcherHost::OnCancelRequest(int request_id) { | 642 void ResourceDispatcherHost::OnCancelRequest(int request_id) { |
641 CancelRequest(filter_->child_id(), request_id, true); | 643 CancelRequest(filter_->child_id(), request_id, true); |
642 } | 644 } |
643 | 645 |
| 646 // Assigns the pending request a new routing_id because it was transferred |
| 647 // to a new page. |
| 648 void ResourceDispatcherHost::OnTransferRequestToNewPage(int new_routing_id, |
| 649 int request_id) { |
| 650 PendingRequestList::iterator i = pending_requests_.find( |
| 651 GlobalRequestID(filter_->child_id(), request_id)); |
| 652 if (i == pending_requests_.end()) { |
| 653 // We probably want to remove this warning eventually, but I wanted to be |
| 654 // able to notice when this happens during initial development since it |
| 655 // should be rare and may indicate a bug. |
| 656 DLOG(WARNING) << "Updating a request that wasn't found"; |
| 657 return; |
| 658 } |
| 659 net::URLRequest* request = i->second; |
| 660 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
| 661 info->set_route_id(new_routing_id); |
| 662 } |
| 663 |
644 void ResourceDispatcherHost::OnFollowRedirect( | 664 void ResourceDispatcherHost::OnFollowRedirect( |
645 int request_id, | 665 int request_id, |
646 bool has_new_first_party_for_cookies, | 666 bool has_new_first_party_for_cookies, |
647 const GURL& new_first_party_for_cookies) { | 667 const GURL& new_first_party_for_cookies) { |
648 FollowDeferredRedirect(filter_->child_id(), request_id, | 668 FollowDeferredRedirect(filter_->child_id(), request_id, |
649 has_new_first_party_for_cookies, | 669 has_new_first_party_for_cookies, |
650 new_first_party_for_cookies); | 670 new_first_party_for_cookies); |
651 } | 671 } |
652 | 672 |
653 ResourceDispatcherHostRequestInfo* | 673 ResourceDispatcherHostRequestInfo* |
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2116 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2136 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
2117 } | 2137 } |
2118 | 2138 |
2119 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2139 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
2120 return allow_cross_origin_auth_prompt_; | 2140 return allow_cross_origin_auth_prompt_; |
2121 } | 2141 } |
2122 | 2142 |
2123 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2143 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
2124 allow_cross_origin_auth_prompt_ = value; | 2144 allow_cross_origin_auth_prompt_ = value; |
2125 } | 2145 } |
OLD | NEW |