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

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

Powered by Google App Engine
This is Rietveld 408576698