Chromium Code Reviews| Index: content/renderer/render_view_impl.cc |
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
| index 53ba225f7281ccaee4461a09ec72ed48764a1fe4..1c4f80986a415dd37d513d931e8b88a2641d3019 100644 |
| --- a/content/renderer/render_view_impl.cc |
| +++ b/content/renderer/render_view_impl.cc |
| @@ -638,6 +638,7 @@ RenderViewImpl::RenderViewImpl(const ViewMsg_New_Params& params) |
| top_controls_constraints_(TOP_CONTROLS_STATE_BOTH), |
| #endif |
| has_scrolled_focused_editable_node_into_rect_(false), |
| + main_render_frame_(nullptr), |
| speech_recognition_dispatcher_(NULL), |
| mouse_lock_dispatcher_(NULL), |
| #if defined(OS_ANDROID) |
| @@ -668,24 +669,58 @@ void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, |
| // Ensure we start with a valid next_page_id_ from the browser. |
| DCHECK_GE(next_page_id_, 0); |
| - main_render_frame_ = RenderFrameImpl::Create( |
| - this, params.main_frame_routing_id); |
| - // The main frame WebLocalFrame object is closed by |
| - // RenderFrameImpl::frameDetached(). |
| - WebLocalFrame* web_frame = WebLocalFrame::create( |
| - blink::WebTreeScopeType::Document, main_render_frame_); |
| - main_render_frame_->SetWebFrame(web_frame); |
| + if (params.main_frame_routing_id != MSG_ROUTING_NONE) { |
| + main_render_frame_ = RenderFrameImpl::Create( |
| + this, params.main_frame_routing_id); |
| + // The main frame WebLocalFrame object is closed by |
| + // RenderFrameImpl::frameDetached(). |
| + WebLocalFrame* web_frame = WebLocalFrame::create( |
| + blink::WebTreeScopeType::Document, main_render_frame_); |
| + main_render_frame_->SetWebFrame(web_frame); |
| + } |
| compositor_deps_ = compositor_deps; |
| webwidget_ = WebView::create(this); |
| webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
| + g_view_map.Get().insert(std::make_pair(webview(), this)); |
| + g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); |
|
Charlie Reis
2015/06/04 00:02:11
Why did you need to move this up?
nasko
2015/06/04 14:57:14
I want to ensure that any code that does discovery
|
| + |
| const base::CommandLine& command_line = |
| *base::CommandLine::ForCurrentProcess(); |
| if (command_line.HasSwitch(switches::kStatsCollectionController)) |
| stats_collection_observer_.reset(new StatsCollectionObserver(this)); |
| + RenderFrameProxy* proxy = NULL; |
| + if (params.proxy_routing_id != MSG_ROUTING_NONE) { |
| + CHECK(params.swapped_out); |
| + if (main_render_frame_) { |
| + proxy = RenderFrameProxy::CreateProxyToReplaceFrame( |
| + main_render_frame_, params.proxy_routing_id, |
| + blink::WebTreeScopeType::Document); |
| + main_render_frame_->set_render_frame_proxy(proxy); |
| + } else { |
| + proxy = RenderFrameProxy::CreateFrameProxy( |
| + params.proxy_routing_id, |
| + MSG_ROUTING_NONE, |
| + routing_id_, |
| + params.replicated_frame_state); |
| + } |
| + } |
| + |
| + // In --site-per-process, just use the WebRemoteFrame as the main frame. |
| + if (command_line.HasSwitch(switches::kSitePerProcess) && proxy) { |
| + webview()->setMainFrame(proxy->web_frame()); |
| + // Initialize the WebRemoteFrame with information replicated from the |
| + // browser process. |
| + proxy->SetReplicatedState(params.replicated_frame_state); |
| + } else { |
| + webview()->setMainFrame(main_render_frame_->GetWebFrame()); |
| + } |
| + if (main_render_frame_) |
| + main_render_frame_->Initialize(); |
| + |
| #if defined(OS_ANDROID) |
| content_detectors_.push_back(linked_ptr<ContentDetector>( |
| new AddressDetector())); |
| @@ -717,8 +752,6 @@ void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, |
| CompleteInit(); |
| } |
| - g_view_map.Get().insert(std::make_pair(webview(), this)); |
| - g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); |
| webview()->setDeviceScaleFactor(device_scale_factor_); |
| webview()->setDisplayMode(display_mode_); |
| webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| @@ -730,26 +763,6 @@ void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, |
| ApplyWebPreferences(webkit_preferences_, webview()); |
| - RenderFrameProxy* proxy = NULL; |
| - if (params.proxy_routing_id != MSG_ROUTING_NONE) { |
| - CHECK(params.swapped_out); |
| - proxy = RenderFrameProxy::CreateProxyToReplaceFrame( |
| - main_render_frame_, params.proxy_routing_id, |
| - blink::WebTreeScopeType::Document); |
| - main_render_frame_->set_render_frame_proxy(proxy); |
| - } |
| - |
| - // In --site-per-process, just use the WebRemoteFrame as the main frame. |
| - if (command_line.HasSwitch(switches::kSitePerProcess) && proxy) { |
| - webview()->setMainFrame(proxy->web_frame()); |
| - // Initialize the WebRemoteFrame with information replicated from the |
| - // browser process. |
| - proxy->SetReplicatedState(params.replicated_frame_state); |
| - } else { |
| - webview()->setMainFrame(main_render_frame_->GetWebFrame()); |
| - } |
| - main_render_frame_->Initialize(); |
| - |
|
pgorszkowski
2015/09/14 13:26:10
Moving this part before ApplyWebPreferences causes
|
| if (switches::IsTouchDragDropEnabled()) |
| webview()->settings()->setTouchDragDropEnabled(true); |