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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 bool handled = true; | 335 bool handled = true; |
336 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHost, message, *message_was_ok) | 336 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHost, message, *message_was_ok) |
337 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) | 337 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) |
338 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) | 338 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) |
339 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, | 339 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, |
340 OnReleaseDownloadedFile) | 340 OnReleaseDownloadedFile) |
341 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) | 341 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) |
342 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) | 342 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) |
343 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) | 343 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) |
344 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) | 344 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) |
| 345 IPC_MESSAGE_HANDLER(ResourceHostMsg_TransferRequestToNewPage, |
| 346 OnTransferRequestToNewPage) |
345 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) | 347 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) |
346 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) | 348 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) |
347 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 349 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
348 OnDidLoadResourceFromMemoryCache) | 350 OnDidLoadResourceFromMemoryCache) |
349 IPC_MESSAGE_UNHANDLED(handled = false) | 351 IPC_MESSAGE_UNHANDLED(handled = false) |
350 IPC_END_MESSAGE_MAP_EX() | 352 IPC_END_MESSAGE_MAP_EX() |
351 | 353 |
352 if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { | 354 if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { |
353 // We just needed to peek at this message. We still want it to reach its | 355 // We just needed to peek at this message. We still want it to reach its |
354 // normal destination. | 356 // normal destination. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 return; | 633 return; |
632 | 634 |
633 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); | 635 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); |
634 info->set_waiting_for_upload_progress_ack(false); | 636 info->set_waiting_for_upload_progress_ack(false); |
635 } | 637 } |
636 | 638 |
637 void ResourceDispatcherHost::OnCancelRequest(int request_id) { | 639 void ResourceDispatcherHost::OnCancelRequest(int request_id) { |
638 CancelRequest(filter_->child_id(), request_id, true); | 640 CancelRequest(filter_->child_id(), request_id, true); |
639 } | 641 } |
640 | 642 |
| 643 // Assigns the pending request a new routing_id because it was transferred |
| 644 // to a new page. |
| 645 void ResourceDispatcherHost::OnTransferRequestToNewPage(int new_routing_id, |
| 646 int request_id) { |
| 647 PendingRequestList::iterator i = pending_requests_.find( |
| 648 GlobalRequestID(filter_->child_id(), request_id)); |
| 649 if (i == pending_requests_.end()) { |
| 650 // We probably want to remove this warning eventually, but I wanted to be |
| 651 // able to notice when this happens during initial development since it |
| 652 // should be rare and may indicate a bug. |
| 653 DLOG(WARNING) << "Updating a request that wasn't found"; |
| 654 return; |
| 655 } |
| 656 net::URLRequest* request = i->second; |
| 657 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
| 658 info->set_route_id(new_routing_id); |
| 659 } |
| 660 |
641 void ResourceDispatcherHost::OnFollowRedirect( | 661 void ResourceDispatcherHost::OnFollowRedirect( |
642 int request_id, | 662 int request_id, |
643 bool has_new_first_party_for_cookies, | 663 bool has_new_first_party_for_cookies, |
644 const GURL& new_first_party_for_cookies) { | 664 const GURL& new_first_party_for_cookies) { |
645 FollowDeferredRedirect(filter_->child_id(), request_id, | 665 FollowDeferredRedirect(filter_->child_id(), request_id, |
646 has_new_first_party_for_cookies, | 666 has_new_first_party_for_cookies, |
647 new_first_party_for_cookies); | 667 new_first_party_for_cookies); |
648 } | 668 } |
649 | 669 |
650 ResourceDispatcherHostRequestInfo* | 670 ResourceDispatcherHostRequestInfo* |
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2127 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
2108 } | 2128 } |
2109 | 2129 |
2110 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2130 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
2111 return allow_cross_origin_auth_prompt_; | 2131 return allow_cross_origin_auth_prompt_; |
2112 } | 2132 } |
2113 | 2133 |
2114 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2134 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
2115 allow_cross_origin_auth_prompt_ = value; | 2135 allow_cross_origin_auth_prompt_ = value; |
2116 } | 2136 } |
OLD | NEW |