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

Unified Diff: content/browser/renderer_host/render_widget_helper.cc

Issue 9325082: Create window in a new BrowsingInstance when opening a link in a new process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix line break Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_helper.cc
diff --git a/content/browser/renderer_host/render_widget_helper.cc b/content/browser/renderer_host/render_widget_helper.cc
index 7bf4ee311058dd4fb8235a8fc2aad79e7cbf20ff..16e53890a167e5575c63afb7fd0bde7996027e01 100644
--- a/content/browser/renderer_host/render_widget_helper.cc
+++ b/content/browser/renderer_host/render_widget_helper.cc
@@ -215,13 +215,23 @@ void RenderWidgetHelper::CreateNewWindow(
base::ProcessHandle render_process,
int* route_id,
int* surface_id) {
- *route_id = GetNextRoutingID();
- *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer(
- render_process_id_, *route_id);
- // Block resource requests until the view is created, since the HWND might be
- // needed if a response ends up creating a plugin.
- resource_dispatcher_host_->BlockRequestsForRoute(
- render_process_id_, *route_id);
+ if (params.opener_suppressed) {
+ // If the opener is supppressed, we should open the window in a new
+ // BrowsingInstance, and thus a new process. That means the current
+ // renderer process will not be able to route messages to it. Because of
+ // this, we will immediately show and navigate the window in
+ // OnCreateWindowOnUI, using the params provided here.
+ *route_id = MSG_ROUTING_NONE;
+ *surface_id = 0;
+ } else {
+ *route_id = GetNextRoutingID();
+ *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer(
+ render_process_id_, *route_id);
+ // Block resource requests until the view is created, since the HWND might
+ // be needed if a response ends up creating a plugin.
+ resource_dispatcher_host_->BlockRequestsForRoute(
+ render_process_id_, *route_id);
+ }
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -237,9 +247,13 @@ void RenderWidgetHelper::OnCreateWindowOnUI(
if (host)
host->CreateNewWindow(route_id, params);
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&RenderWidgetHelper::OnCreateWindowOnIO, this, route_id));
+ // We only need to resume blocked requests if we used a valid route_id.
+ // See CreateNewWindow.
+ if (route_id != MSG_ROUTING_NONE) {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&RenderWidgetHelper::OnCreateWindowOnIO, this, route_id));
+ }
}
void RenderWidgetHelper::OnCreateWindowOnIO(int route_id) {

Powered by Google App Engine
This is Rietveld 408576698