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

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: Merge with trunk. Created 9 years, 7 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHost, message, *message_was_ok) 338 IPC_BEGIN_MESSAGE_MAP_EX(ResourceDispatcherHost, message, *message_was_ok)
339 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) 339 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource)
340 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) 340 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad)
341 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile, 341 IPC_MESSAGE_HANDLER(ResourceHostMsg_ReleaseDownloadedFile,
342 OnReleaseDownloadedFile) 342 OnReleaseDownloadedFile)
343 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) 343 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK)
344 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK) 344 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataDownloaded_ACK, OnDataDownloadedACK)
345 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK) 345 IPC_MESSAGE_HANDLER(ResourceHostMsg_UploadProgress_ACK, OnUploadProgressACK)
346 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest) 346 IPC_MESSAGE_HANDLER(ResourceHostMsg_CancelRequest, OnCancelRequest)
347 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) 347 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect)
348 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) 348 IPC_MESSAGE_HANDLER(ViewHostMsg_SwapOut_ACK, OnSwapOutACK)
349 IPC_MESSAGE_UNHANDLED(handled = false) 349 IPC_MESSAGE_UNHANDLED(handled = false)
350 IPC_END_MESSAGE_MAP_EX() 350 IPC_END_MESSAGE_MAP_EX()
351 351
352 filter_ = NULL; 352 filter_ = NULL;
353 return handled; 353 return handled;
354 } 354 }
355 355
356 void ResourceDispatcherHost::OnRequestResource( 356 void ResourceDispatcherHost::OnRequestResource(
357 const IPC::Message& message, 357 const IPC::Message& message,
358 int request_id, 358 int request_id,
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 route_id, 710 route_id,
711 request_id_, 711 request_id_,
712 ResourceType::SUB_RESOURCE, 712 ResourceType::SUB_RESOURCE,
713 0, // upload_size 713 0, // upload_size
714 download, // is_download 714 download, // is_download
715 download, // allow_download 715 download, // allow_download
716 false, // has_user_gesture 716 false, // has_user_gesture
717 &context); 717 &context);
718 } 718 }
719 719
720 void ResourceDispatcherHost::OnClosePageACK( 720 void ResourceDispatcherHost::OnSwapOutACK(
721 const ViewMsg_ClosePage_Params& params) { 721 const ViewMsg_SwapOut_Params& params) {
722 if (params.for_cross_site_transition) { 722 // Closes for cross-site transitions are handled such that the cross-site
723 // Closes for cross-site transitions are handled such that the cross-site 723 // transition continues.
724 // transition continues. 724 GlobalRequestID global_id(params.new_render_process_host_id,
725 GlobalRequestID global_id(params.new_render_process_host_id, 725 params.new_request_id);
726 params.new_request_id); 726 PendingRequestList::iterator i = pending_requests_.find(global_id);
727 PendingRequestList::iterator i = pending_requests_.find(global_id); 727 if (i != pending_requests_.end()) {
728 if (i != pending_requests_.end()) { 728 // The response we were meant to resume could have already been canceled.
729 // The response we were meant to resume could have already been canceled. 729 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second);
730 ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second); 730 if (info->cross_site_handler())
731 if (info->cross_site_handler()) 731 info->cross_site_handler()->ResumeResponse();
732 info->cross_site_handler()->ResumeResponse();
733 }
734 } else {
735 // This is a tab close, so we will close the tab in OnClosePageACK.
736 DCHECK(params.new_render_process_host_id == -1);
737 DCHECK(params.new_request_id == -1);
738 } 732 }
739 // Update the RenderViewHost's internal state after the ACK. 733 // Update the RenderViewHost's internal state after the ACK.
740 CallRenderViewHost(params.closing_process_id, 734 CallRenderViewHost(params.closing_process_id,
741 params.closing_route_id, 735 params.closing_route_id,
742 &RenderViewHost::OnClosePageACK, 736 &RenderViewHost::OnSwapOutACK);
743 params.for_cross_site_transition);
744 } 737 }
745 738
746 // We are explicitly forcing the download of 'url'. 739 // We are explicitly forcing the download of 'url'.
747 void ResourceDispatcherHost::BeginDownload( 740 void ResourceDispatcherHost::BeginDownload(
748 const GURL& url, 741 const GURL& url,
749 const GURL& referrer, 742 const GURL& referrer,
750 const DownloadSaveInfo& save_info, 743 const DownloadSaveInfo& save_info,
751 bool prompt_for_save_location, 744 bool prompt_for_save_location,
752 int child_id, 745 int child_id,
753 int route_id, 746 int route_id,
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 return is_prefetch_enabled_; 2000 return is_prefetch_enabled_;
2008 } 2001 }
2009 2002
2010 // static 2003 // static
2011 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { 2004 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) {
2012 is_prefetch_enabled_ = value; 2005 is_prefetch_enabled_ = value;
2013 } 2006 }
2014 2007
2015 // static 2008 // static
2016 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; 2009 bool ResourceDispatcherHost::is_prefetch_enabled_ = false;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698