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

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

Issue 1376003002: Make rendering timeouts work even if paint data received early (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cursor
Patch Set: Rebase that maybe works this time Created 5 years, 3 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 323c0b810fd32f4d2ac3c1f3e9618bc8cbc2af73..446080e133396781e6bee98408659dddb5b0a8a8 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -197,6 +197,7 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
allow_privileged_mouse_lock_(false),
has_touch_handler_(false),
is_in_gesture_scroll_(false),
+ received_paint_after_load_(false),
next_browser_snapshot_id_(1),
owned_by_render_frame_host_(false),
is_focused_(false),
@@ -920,6 +921,14 @@ void RenderWidgetHostImpl::StopHangMonitorTimeout() {
}
void RenderWidgetHostImpl::StartNewContentRenderingTimeout() {
+ // It is possible for a compositor frame to arrive before the browser
+ // is notified about the page have been committed, in which case
Charlie Reis 2015/09/30 20:36:19 nit: about the page being committed
kenrb 2015/09/30 21:25:02 Done.
+ // no timer is necessary.
+ if (received_paint_after_load_) {
+ received_paint_after_load_ = false;
+ return;
+ }
+
if (new_content_rendering_timeout_)
new_content_rendering_timeout_->Start(new_content_rendering_delay_);
}
@@ -929,6 +938,14 @@ void RenderWidgetHostImpl::StopNewContentRenderingTimeout() {
new_content_rendering_timeout_->Stop();
}
+void RenderWidgetHostImpl::OnFirstPaintAfterLoad() {
+ if (new_content_rendering_timeout_->IsRunning()) {
+ StopNewContentRenderingTimeout();
+ } else {
+ received_paint_after_load_ = true;
+ }
+}
+
void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo());
}
@@ -1522,8 +1539,6 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame(
// chrome/browser/extensions/api/cast_streaming/performance_test.cc
TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame");
- StopNewContentRenderingTimeout();
-
ViewHostMsg_SwapCompositorFrame::Param param;
if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param))
return false;

Powered by Google App Engine
This is Rietveld 408576698