Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2707243005: Discard compositor frames from unloaded web content (Closed)
Patch Set: Small changes for review comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..45c15bf44d4435df01ee2b7ecc3736526097850a 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.
@@ -1849,6 +1852,10 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame(
latency_tracker_.OnSwapCompositorFrame(&frame.metadata.latency_info);
+ // Ignore this frame if its content has already been unloaded.
enne (OOO) 2017/02/28 22:23:21 I agree that maybe the mobile optimized and double
kenrb 2017/03/01 15:32:47 Done.
+ if (frame.metadata.content_source_id < current_content_source_id_)
+ return false;
+
bool is_mobile_optimized = IsMobileOptimizedFrame(frame.metadata);
input_router_->NotifySiteIsMobileOptimized(is_mobile_optimized);
if (touch_emulator_)
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698