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 void ResourceDispatcherHost::OnTransferRequestToNewPage(const IPC::Message& msg, | |
647 int request_id) { | |
648 TransferRequestToNewPage(filter_->child_id(), msg.routing_id(), request_id); | |
jam
2011/08/15 16:31:02
nit: no need to call out from message dispatcher t
Dmitry Titov
2011/08/15 20:50:10
Done.
| |
649 } | |
650 | |
644 void ResourceDispatcherHost::OnFollowRedirect( | 651 void ResourceDispatcherHost::OnFollowRedirect( |
645 int request_id, | 652 int request_id, |
646 bool has_new_first_party_for_cookies, | 653 bool has_new_first_party_for_cookies, |
647 const GURL& new_first_party_for_cookies) { | 654 const GURL& new_first_party_for_cookies) { |
648 FollowDeferredRedirect(filter_->child_id(), request_id, | 655 FollowDeferredRedirect(filter_->child_id(), request_id, |
649 has_new_first_party_for_cookies, | 656 has_new_first_party_for_cookies, |
650 new_first_party_for_cookies); | 657 new_first_party_for_cookies); |
651 } | 658 } |
652 | 659 |
653 ResourceDispatcherHostRequestInfo* | 660 ResourceDispatcherHostRequestInfo* |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1319 | 1326 |
1320 if (CancelRequestInternal(request, from_renderer) && | 1327 if (CancelRequestInternal(request, from_renderer) && |
1321 !started_before_cancel) { | 1328 !started_before_cancel) { |
1322 // If the request isn't in flight, then we won't get asyncronous | 1329 // If the request isn't in flight, then we won't get asyncronous |
1323 // notification, so we have to signal ourselves to finish this | 1330 // notification, so we have to signal ourselves to finish this |
1324 // request. | 1331 // request. |
1325 OnResponseCompleted(request); | 1332 OnResponseCompleted(request); |
1326 } | 1333 } |
1327 } | 1334 } |
1328 | 1335 |
1336 void ResourceDispatcherHost::TransferRequestToNewPage(int process_unique_id, | |
1337 int new_routing_id, | |
1338 int request_id) { | |
1339 PendingRequestList::iterator i = pending_requests_.find( | |
1340 GlobalRequestID(process_unique_id, request_id)); | |
1341 if (i == pending_requests_.end()) { | |
1342 // We probably want to remove this warning eventually, but I wanted to be | |
1343 // able to notice when this happens during initial development since it | |
1344 // should be rare and may indicate a bug. | |
1345 DLOG(WARNING) << "Updating a request that wasn't found"; | |
1346 return; | |
1347 } | |
1348 net::URLRequest* request = i->second; | |
1349 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | |
1350 info->set_route_id(new_routing_id); | |
1351 } | |
1352 | |
1329 bool ResourceDispatcherHost::CancelRequestInternal(net::URLRequest* request, | 1353 bool ResourceDispatcherHost::CancelRequestInternal(net::URLRequest* request, |
1330 bool from_renderer) { | 1354 bool from_renderer) { |
1331 VLOG(1) << "CancelRequest: " << request->url().spec(); | 1355 VLOG(1) << "CancelRequest: " << request->url().spec(); |
1332 | 1356 |
1333 // WebKit will send us a cancel for downloads since it no longer handles them. | 1357 // WebKit will send us a cancel for downloads since it no longer handles them. |
1334 // In this case, ignore the cancel since we handle downloads in the browser. | 1358 // In this case, ignore the cancel since we handle downloads in the browser. |
1335 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1359 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
1336 if (!from_renderer || !info->is_download()) { | 1360 if (!from_renderer || !info->is_download()) { |
1337 if (info->login_delegate()) { | 1361 if (info->login_delegate()) { |
1338 info->login_delegate()->OnRequestCancelled(); | 1362 info->login_delegate()->OnRequestCancelled(); |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2125 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; | 2149 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; |
2126 } | 2150 } |
2127 | 2151 |
2128 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { | 2152 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { |
2129 return allow_cross_origin_auth_prompt_; | 2153 return allow_cross_origin_auth_prompt_; |
2130 } | 2154 } |
2131 | 2155 |
2132 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { | 2156 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { |
2133 allow_cross_origin_auth_prompt_ = value; | 2157 allow_cross_origin_auth_prompt_ = value; |
2134 } | 2158 } |
OLD | NEW |