Chromium Code Reviews| Index: content/browser/renderer_host/render_view_host_impl.cc |
| diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc |
| index 7897b7a4c094ca5a7e5e52747dd712cba7a71024..4c2c1fac8b5880504604f97372ad5cbba1bfc173 100644 |
| --- a/content/browser/renderer_host/render_view_host_impl.cc |
| +++ b/content/browser/renderer_host/render_view_host_impl.cc |
| @@ -224,6 +224,7 @@ RenderViewHostImpl::RenderViewHostImpl( |
| virtual_keyboard_requested_(false), |
| is_focused_element_editable_(false), |
| updating_web_preferences_(false), |
| + render_view_ready_on_process_launch_(false), |
| weak_factory_(this) { |
| DCHECK(instance_.get()); |
| CHECK(delegate_); // http://crbug.com/82827 |
| @@ -351,6 +352,8 @@ bool RenderViewHostImpl::CreateRenderView( |
| RenderFrameHostImpl::FromID(GetProcess()->GetID(), main_frame_routing_id_) |
| ->SetRenderFrameCreated(true); |
| } |
| + SendScreenRects(); |
| + PostRenderViewReady(); |
| return true; |
| } |
| @@ -582,6 +585,13 @@ void RenderViewHostImpl::RequestFindMatchRects(int current_version) { |
| } |
| #endif |
| +void RenderViewHostImpl::RenderProcessReady(RenderProcessHost* host) { |
| + if (render_view_ready_on_process_launch_) { |
| + render_view_ready_on_process_launch_ = false; |
| + RenderViewReady(); |
| + } |
| +} |
| + |
| void RenderViewHostImpl::RenderProcessExited(RenderProcessHost* host, |
| base::TerminationStatus status, |
| int exit_code) { |
| @@ -903,7 +913,6 @@ bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) { |
| IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) |
| IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, |
| OnShowFullscreenWidget) |
| - IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) |
| IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) |
| IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) |
| IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) |
| @@ -934,6 +943,7 @@ bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) { |
| void RenderViewHostImpl::Init() { |
| RenderWidgetHostImpl::Init(); |
| + PostRenderViewReady(); |
| } |
| void RenderViewHostImpl::Shutdown() { |
| @@ -1022,13 +1032,6 @@ void RenderViewHostImpl::OnShowFullscreenWidget(int route_id) { |
| Send(new ViewMsg_Move_ACK(route_id)); |
| } |
| -void RenderViewHostImpl::OnRenderViewReady() { |
| - render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING; |
| - SendScreenRects(); |
| - WasResized(); |
| - delegate_->RenderViewReady(this); |
| -} |
| - |
| void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { |
| // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a |
| // RenderViewHostImpl and destroy itself. |
| @@ -1426,4 +1429,20 @@ void RenderViewHostImpl::SelectWordAroundCaret() { |
| Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| } |
| +void RenderViewHostImpl::PostRenderViewReady() { |
| + if (GetProcess()->IsReady()) { |
| + BrowserThread::PostTask( |
|
ncarter (slow)
2015/09/29 18:28:40
How confident are you that this posted task won't
piman
2015/09/29 23:54:27
So, it is already the case today that IPCs can be
ncarter (slow)
2015/09/30 20:30:33
Ah, okay. I had assumed that RenderViewReady was h
|
| + BrowserThread::UI, |
| + FROM_HERE, |
| + base::Bind(&RenderViewHostImpl::RenderViewReady, |
| + weak_factory_.GetWeakPtr())); |
|
ncarter (slow)
2015/09/29 18:28:40
Also, what breaks if you just call RenderViewReady
piman
2015/09/29 23:54:27
There's at least a couple of places that I found,
ncarter (slow)
2015/09/30 20:30:33
This makes sense.
|
| + } else { |
| + render_view_ready_on_process_launch_ = true; |
| + } |
| +} |
| + |
| +void RenderViewHostImpl::RenderViewReady() { |
| + delegate_->RenderViewReady(this); |
| +} |
| + |
| } // namespace content |