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) | |
347 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) | 345 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) |
348 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) | 346 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK) |
349 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 347 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
350 OnDidLoadResourceFromMemoryCache) | 348 OnDidLoadResourceFromMemoryCache) |
351 IPC_MESSAGE_UNHANDLED(handled = false) | 349 IPC_MESSAGE_UNHANDLED(handled = false) |
352 IPC_END_MESSAGE_MAP_EX() | 350 IPC_END_MESSAGE_MAP_EX() |
353 | 351 |
354 if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { | 352 if (message.type() == ViewHostMsg_DidLoadResourceFromMemoryCache::ID) { |
355 // We just needed to peek at this message. We still want it to reach its | 353 // We just needed to peek at this message. We still want it to reach its |
356 // normal destination. | 354 // normal destination. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 return; | 631 return; |
634 | 632 |
635 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); | 633 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); |
636 info->set_waiting_for_upload_progress_ack(false); | 634 info->set_waiting_for_upload_progress_ack(false); |
637 } | 635 } |
638 | 636 |
639 void ResourceDispatcherHost::OnCancelRequest(int request_id) { | 637 void ResourceDispatcherHost::OnCancelRequest(int request_id) { |
640 CancelRequest(filter_->child_id(), request_id, true); | 638 CancelRequest(filter_->child_id(), request_id, true); |
641 } | 639 } |
642 | 640 |
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 | |
661 void ResourceDispatcherHost::OnFollowRedirect( | 641 void ResourceDispatcherHost::OnFollowRedirect( |
662 int request_id, | 642 int request_id, |
663 bool has_new_first_party_for_cookies, | 643 bool has_new_first_party_for_cookies, |
664 const GURL& new_first_party_for_cookies) { | 644 const GURL& new_first_party_for_cookies) { |
665 FollowDeferredRedirect(filter_->child_id(), request_id, | 645 FollowDeferredRedirect(filter_->child_id(), request_id, |
666 has_new_first_party_for_cookies, | 646 has_new_first_party_for_cookies, |
667 new_first_party_for_cookies); | 647 new_first_party_for_cookies); |
668 } | 648 } |
669 | 649 |
670 ResourceDispatcherHostRequestInfo* | 650 ResourceDispatcherHostRequestInfo* |
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2127 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2107 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
2128 } | 2108 } |
2129 | 2109 |
2130 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2110 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
2131 return allow_cross_origin_auth_prompt_; | 2111 return allow_cross_origin_auth_prompt_; |
2132 } | 2112 } |
2133 | 2113 |
2134 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2114 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
2135 allow_cross_origin_auth_prompt_ = value; | 2115 allow_cross_origin_auth_prompt_ = value; |
2136 } | 2116 } |
OLD | NEW |