Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host.cc

Issue 6319001: Support window.opener after a process swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comments. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHost, message, *message_was_ok) 307 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHost, message, *message_was_ok)
308 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) 308 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource)
309 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) 309 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad)
310 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, 310 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile,
311 OnReleaseDownloadedFile) 311 OnReleaseDownloadedFile)
312 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) 312 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK)
313 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) 313 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK)
314 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) 314 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK)
315 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) 315 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest)
316 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) 316 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect)
317 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) 317 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK)
318 IPC_MESSAGE_UNHANDLED(handled = false) 318 IPC_MESSAGE_UNHANDLED(handled = false)
319 IPC_END_MESSAGE_MAP_EX() 319 IPC_END_MESSAGE_MAP_EX()
320 320
321 filter_ = NULL; 321 filter_ = NULL;
322 return handled; 322 return handled;
323 } 323 }
324 324
325 void ResourceDispatcherHost::OnRequestResource( 325 void ResourceDispatcherHost::OnRequestResource(
326 const IPC::Message& message, 326 const IPC::Message& message,
327 int request_id, 327 int request_id,
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 child_id, 635 child_id,
636 route_id, 636 route_id,
637 request_id_, 637 request_id_,
638 ResourceType::SUB_RESOURCE, 638 ResourceType::SUB_RESOURCE,
639 0, // upload_size 639 0, // upload_size
640 download, // is_download 640 download, // is_download
641 download, // allow_download 641 download, // allow_download
642 false); // has_user_gesture 642 false); // has_user_gesture
643 } 643 }
644 644
645 void ResourceDispatcherHost::OnClosePageACK( 645 void ResourceDispatcherHost::OnSwapOutACK(
646 const ViewMsg_ClosePage_Params& params) { 646 const ViewMsg_SwapOut_Params& params) {
647 if (params.for_cross_site_transition) { 647 // Closes for cross-site transitions are handled such that the cross-site
648 // Closes for cross-site transitions are handled such that the cross-site 648 // transition continues.
649 // transition continues. 649 GlobalRequestID global_id(params.new_render_process_host_id,
650 GlobalRequestID global_id(params.new_render_process_host_id, 650 params.new_request_id);
651 params.new_request_id); 651 PendingRequestList::iterator i = pending_requests_.find(global_id);
652 PendingRequestList::iterator i = pending_requests_.find(global_id); 652 if (i != pending_requests_.end()) {
653 if (i != pending_requests_.end()) { 653 // The response we were meant to resume could have already been canceled.
654 // The response we were meant to resume could have already been canceled. 654 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second);
655 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); 655 if (info->cross_site_handler())
656 if (info->cross_site_handler()) 656 info->cross_site_handler()->ResumeResponse();
657 info->cross_site_handler()->ResumeResponse();
658 }
659 } else {
660 // This is a tab close, so we will close the tab in OnClosePageACK.
661 DCHECK(params.new_render_process_host_id == -1);
662 DCHECK(params.new_request_id == -1);
663 } 657 }
664 // Update the RenderViewHost's internal state after the ACK. 658 // Update the RenderViewHost's internal state after the ACK.
665 CallRenderViewHost(params.closing_process_id, 659 CallRenderViewHost(params.closing_process_id,
666 params.closing_route_id, 660 params.closing_route_id,
667 &RenderViewHost::OnClosePageACK, 661 &RenderViewHost::OnSwapOutACK);
668 params.for_cross_site_transition);
669 } 662 }
670 663
671 // We are explicitly forcing the download of 'url'. 664 // We are explicitly forcing the download of 'url'.
672 void ResourceDispatcherHost::BeginDownload( 665 void ResourceDispatcherHost::BeginDownload(
673 const GURL& url, 666 const GURL& url,
674 const GURL& referrer, 667 const GURL& referrer,
675 const DownloadSaveInfo& save_info, 668 const DownloadSaveInfo& save_info,
676 bool prompt_for_save_location, 669 bool prompt_for_save_location,
677 int child_id, 670 int child_id,
678 int route_id, 671 int route_id,
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 return is_prefetch_enabled_; 1941 return is_prefetch_enabled_;
1949 } 1942 }
1950 1943
1951 // static 1944 // static
1952 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { 1945 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) {
1953 is_prefetch_enabled_ = value; 1946 is_prefetch_enabled_ = value;
1954 } 1947 }
1955 1948
1956 // static 1949 // static
1957 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; 1950 bool ResourceDispatcherHost::is_prefetch_enabled_ = false;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698