Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_impl.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc |
| index 0f488d8d88c866c07413ade08acdc0fc1ff70551..46212207761fd83725eec2dcb1f1da8d89c610d4 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.cc |
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc |
| @@ -294,6 +294,7 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, |
| last_event_type_(blink::WebInputEvent::Undefined), |
| new_content_rendering_delay_( |
| base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)), |
| + current_content_source_id_(0), |
| weak_factory_(this) { |
| CHECK(delegate_); |
| CHECK_NE(MSG_ROUTING_NONE, routing_id_); |
| @@ -1010,7 +1011,9 @@ void RenderWidgetHostImpl::StopHangMonitorTimeout() { |
| RendererIsResponsive(); |
| } |
| -void RenderWidgetHostImpl::StartNewContentRenderingTimeout() { |
| +void RenderWidgetHostImpl::StartNewContentRenderingTimeout( |
| + uint32_t next_source_id) { |
| + current_content_source_id_ = next_source_id; |
| // It is possible for a compositor frame to arrive before the browser is |
| // notified about the page being committed, in which case no timer is |
| // necessary. |
| @@ -1854,7 +1857,8 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame( |
| if (touch_emulator_) |
| touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
| - if (view_) { |
| + // Ignore this frame if its content has already been unloaded. |
| + if (view_ && frame.metadata.content_source_id >= current_content_source_id_) { |
|
Charlie Reis
2017/03/01 20:13:29
What if this came from an OOPIF? Is it safe becau
kenrb
2017/03/02 17:08:17
Yes, and done.
|
| view_->OnSwapCompositorFrame(compositor_frame_sink_id, std::move(frame)); |
| view_->DidReceiveRendererFrame(); |
| } else { |