Commit 052873a8 authored by Fergal Daly's avatar Fergal Daly Committed by Commit Bot

Remove view/widget/frame routing IDs from WebContents::CreateParams.

There was only one site populating these and it was not necessary (it
was already skipping population if this was a new browsing instance).

This is a pre-factor for https://crrev.com/c/2084038

Change-Id: I585160d2533fc5adfbe317a1ace2166b8a378915
Bug: 1059678
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094579Reviewed-by: default avatarLuke Halliwell (slow) <halliwell@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Auto-Submit: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749164}
parent 2b190816
...@@ -43,7 +43,6 @@ std::unique_ptr<content::WebContents> CreateWebContents( ...@@ -43,7 +43,6 @@ std::unique_ptr<content::WebContents> CreateWebContents(
content::BrowserContext* browser_context, content::BrowserContext* browser_context,
scoped_refptr<content::SiteInstance> site_instance) { scoped_refptr<content::SiteInstance> site_instance) {
content::WebContents::CreateParams create_params(browser_context, nullptr); content::WebContents::CreateParams create_params(browser_context, nullptr);
create_params.routing_id = MSG_ROUTING_NONE;
create_params.site_instance = site_instance; create_params.site_instance = site_instance;
return content::WebContents::Create(create_params); return content::WebContents::Create(create_params);
} }
......
...@@ -2047,14 +2047,6 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { ...@@ -2047,14 +2047,6 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
if (!params.last_active_time.is_null()) if (!params.last_active_time.is_null())
last_active_time_ = params.last_active_time; last_active_time_ = params.last_active_time;
// The routing ids must either all be set or all be unset.
DCHECK((params.routing_id == MSG_ROUTING_NONE &&
params.main_frame_routing_id == MSG_ROUTING_NONE &&
params.main_frame_widget_routing_id == MSG_ROUTING_NONE) ||
(params.routing_id != MSG_ROUTING_NONE &&
params.main_frame_routing_id != MSG_ROUTING_NONE &&
params.main_frame_widget_routing_id != MSG_ROUTING_NONE));
scoped_refptr<SiteInstance> site_instance = params.site_instance; scoped_refptr<SiteInstance> site_instance = params.site_instance;
if (!site_instance) if (!site_instance)
site_instance = SiteInstance::Create(params.browser_context); site_instance = SiteInstance::Create(params.browser_context);
...@@ -2068,19 +2060,16 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { ...@@ -2068,19 +2060,16 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
// TODO(avi): Once RenderViewHostImpl has-a RenderWidgetHostImpl, it will no // TODO(avi): Once RenderViewHostImpl has-a RenderWidgetHostImpl, it will no
// longer be necessary to eagerly grab a routing ID for the view. // longer be necessary to eagerly grab a routing ID for the view.
// https://crbug.com/545684 // https://crbug.com/545684
int32_t view_routing_id = params.routing_id; int32_t view_routing_id = site_instance->GetProcess()->GetNextRoutingID();
int32_t main_frame_widget_routing_id = params.main_frame_widget_routing_id; int32_t main_frame_widget_routing_id =
if (main_frame_widget_routing_id == MSG_ROUTING_NONE) { site_instance->GetProcess()->GetNextRoutingID();
view_routing_id = site_instance->GetProcess()->GetNextRoutingID();
main_frame_widget_routing_id =
site_instance->GetProcess()->GetNextRoutingID();
}
DCHECK_NE(view_routing_id, main_frame_widget_routing_id); DCHECK_NE(view_routing_id, main_frame_widget_routing_id);
GetRenderManager()->Init( GetRenderManager()->Init(site_instance.get(), view_routing_id,
site_instance.get(), view_routing_id, params.main_frame_routing_id, /*frame_routing_id=*/MSG_ROUTING_NONE,
main_frame_widget_routing_id, params.renderer_initiated_creation); main_frame_widget_routing_id,
params.renderer_initiated_creation);
// blink::FrameTree::setName always keeps |unique_name| empty in case of a // blink::FrameTree::setName always keeps |unique_name| empty in case of a
// main frame - let's do the same thing here. // main frame - let's do the same thing here.
...@@ -2915,22 +2904,6 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( ...@@ -2915,22 +2904,6 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
// objects. // objects.
create_params.renderer_initiated_creation = !is_new_browsing_instance; create_params.renderer_initiated_creation = !is_new_browsing_instance;
// If |is_new_browsing_instance| is true, defer routing_id allocation
// to the WebContentsImpl::Create() call. This is required because with
// a new browsing instance, WebContentsImpl::Create() may elect a different
// SiteInstance from |site_instance| (which happens if |site_instance| is
// nullptr for example).
//
// TODO(ajwong): This routing id allocation should be pushed down further
// into WebContentsImpl::Create().
if (!is_new_browsing_instance) {
create_params.routing_id = opener->GetProcess()->GetNextRoutingID();
create_params.main_frame_routing_id =
opener->GetProcess()->GetNextRoutingID();
create_params.main_frame_widget_routing_id =
opener->GetProcess()->GetNextRoutingID();
}
std::unique_ptr<WebContentsImpl> new_contents; std::unique_ptr<WebContentsImpl> new_contents;
if (!is_guest) { if (!is_guest) {
create_params.context = view_->GetNativeView(); create_params.context = view_->GetNativeView();
...@@ -2973,9 +2946,10 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( ...@@ -2973,9 +2946,10 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
// TODO(ajwong): This should be keyed off the RenderFrame routing id or the // TODO(ajwong): This should be keyed off the RenderFrame routing id or the
// FrameTreeNode id instead of the routing id of the Widget for the main // FrameTreeNode id instead of the routing id of the Widget for the main
// frame. https://crbug.com/545684 // frame. https://crbug.com/545684
DCHECK_NE(MSG_ROUTING_NONE, create_params.main_frame_routing_id); int32_t main_frame_routing_id = new_contents_impl->GetMainFrame()
GlobalRoutingID id(render_process_id, ->GetRenderWidgetHost()
create_params.main_frame_widget_routing_id); ->GetRoutingID();
GlobalRoutingID id(render_process_id, main_frame_routing_id);
pending_contents_[id] = std::move(new_contents); pending_contents_[id] = std::move(new_contents);
AddDestructionObserver(new_contents_impl); AddDestructionObserver(new_contents_impl);
} }
......
...@@ -22,9 +22,6 @@ WebContents::CreateParams::CreateParams(BrowserContext* context, ...@@ -22,9 +22,6 @@ WebContents::CreateParams::CreateParams(BrowserContext* context,
opener_render_frame_id(MSG_ROUTING_NONE), opener_render_frame_id(MSG_ROUTING_NONE),
opener_suppressed(false), opener_suppressed(false),
created_with_opener(false), created_with_opener(false),
routing_id(MSG_ROUTING_NONE),
main_frame_routing_id(MSG_ROUTING_NONE),
main_frame_widget_routing_id(MSG_ROUTING_NONE),
initially_hidden(false), initially_hidden(false),
guest_delegate(nullptr), guest_delegate(nullptr),
context(nullptr), context(nullptr),
......
...@@ -142,14 +142,6 @@ class WebContents : public PageNavigator, ...@@ -142,14 +142,6 @@ class WebContents : public PageNavigator,
// (e.g., for blocked popups). // (e.g., for blocked popups).
bool created_with_opener; bool created_with_opener;
// The routing ids of the RenderView, main RenderFrame, and the widget for
// the main RenderFrame. Either all routing IDs must be provided or all must
// be MSG_ROUTING_NONE to have WebContents make the assignment. If provided,
// these routing IDs are associated with |site_instance->GetProcess()|.
int32_t routing_id;
int32_t main_frame_routing_id;
int32_t main_frame_widget_routing_id;
// The name of the top-level frame of the new window. It is non-empty // The name of the top-level frame of the new window. It is non-empty
// when creating a named window (e.g. <a target="foo"> or // when creating a named window (e.g. <a target="foo"> or
// window.open('', 'bar')). // window.open('', 'bar')).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment