Disallow lazy assignment of RenderWidgetHostImpl routing IDs.
Currently, when RenderFrameHosts need a RenderWidgetHost, the RWH is
lazily assigned a routing ID and surface ID. Unfortunately, this does
not work when binding a RenderWidgetHost to the main RenderFrameHost:
certain initialization paths require that the routing ID / surface be
pre-allocated, in order to service a sync IPC.
Rather than creating two distinct paths for binding a RenderWidgetHost
to a RenderFrameHost, just require all initialization paths to
pre-allocate the routing ID and surface.
BUG=419087
Review URL: https://codereview.chromium.org/1309233006
Cr-Commit-Position: refs/heads/master@{#346477}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 96395bf..5def820 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1340,9 +1340,9 @@
params.main_frame_routing_id == MSG_ROUTING_NONE) ||
(params.routing_id != MSG_ROUTING_NONE &&
params.main_frame_routing_id != MSG_ROUTING_NONE));
- GetRenderManager()->Init(
- params.browser_context, params.site_instance, params.routing_id,
- params.main_frame_routing_id);
+ GetRenderManager()->Init(params.browser_context, params.site_instance,
+ params.routing_id, params.main_frame_routing_id,
+ MSG_ROUTING_NONE, 0 /* surface_id */);
frame_tree_.root()->SetFrameName(params.main_frame_name);
WebContentsViewDelegate* delegate =
@@ -1807,19 +1807,23 @@
}
}
-void WebContentsImpl::CreateNewWidget(int render_process_id,
- int route_id,
+void WebContentsImpl::CreateNewWidget(int32 render_process_id,
+ int32 route_id,
+ int32 surface_id,
blink::WebPopupType popup_type) {
- CreateNewWidget(render_process_id, route_id, false, popup_type);
+ CreateNewWidget(render_process_id, route_id, surface_id, false, popup_type);
}
-void WebContentsImpl::CreateNewFullscreenWidget(int render_process_id,
- int route_id) {
- CreateNewWidget(render_process_id, route_id, true, blink::WebPopupTypeNone);
+void WebContentsImpl::CreateNewFullscreenWidget(int32 render_process_id,
+ int32 route_id,
+ int32 surface_id) {
+ CreateNewWidget(render_process_id, route_id, surface_id, true,
+ blink::WebPopupTypeNone);
}
-void WebContentsImpl::CreateNewWidget(int render_process_id,
- int route_id,
+void WebContentsImpl::CreateNewWidget(int32 render_process_id,
+ int32 route_id,
+ int32 surface_id,
bool is_fullscreen,
blink::WebPopupType popup_type) {
RenderProcessHost* process = GetRenderProcessHost();
@@ -1838,7 +1842,7 @@
}
RenderWidgetHostImpl* widget_host =
- new RenderWidgetHostImpl(this, process, route_id, IsHidden());
+ new RenderWidgetHostImpl(this, process, route_id, surface_id, IsHidden());
created_widgets_.insert(widget_host);
RenderWidgetHostViewBase* widget_view =