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

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

Issue 9129024: Fix for crbug.com/111185. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forgot to commit all changes before uploading. Created 8 years, 11 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.cc
diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc
index 644eca8a47e6df1c778aea1522e3db1ff391a028..495056e25dd8ff72f3b1de5b01850884376ff7b5 100644
--- a/content/browser/renderer_host/render_widget_host.cc
+++ b/content/browser/renderer_host/render_widget_host.cc
@@ -77,6 +77,7 @@ bool ShouldCoalesceMouseWheelEvents(const WebMouseWheelEvent& last_event,
RenderWidgetHost::RenderWidgetHost(content::RenderProcessHost* process,
int routing_id)
: renderer_initialized_(false),
+ hung_renderer_delay_ms_(kHungRendererDelayMs),
renderer_accessible_(false),
view_(NULL),
process_(process),
@@ -94,6 +95,7 @@ RenderWidgetHost::RenderWidgetHost(content::RenderProcessHost* process,
touch_event_is_queued_(false),
needs_repainting_on_restore_(false),
is_unresponsive_(false),
+ in_flight_event_count_(0),
in_get_backing_store_(false),
view_being_painted_(false),
ignore_input_events_(false),
@@ -538,13 +540,13 @@ void RenderWidgetHost::StartHangMonitorTimeout(TimeDelta delay) {
void RenderWidgetHost::RestartHangMonitorTimeout() {
// Setting to null will cause StartHangMonitorTimeout to restart the timer.
time_when_considered_hung_ = Time();
- StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kHungRendererDelayMs));
+ StartHangMonitorTimeout(
+ TimeDelta::FromMilliseconds(hung_renderer_delay_ms_));
}
void RenderWidgetHost::StopHangMonitorTimeout() {
time_when_considered_hung_ = Time();
RendererIsResponsive();
-
// We do not bother to stop the hung_renderer_timer_ here in case it will be
// started again shortly, which happens to be the common use case.
}
@@ -719,7 +721,9 @@ void RenderWidgetHost::ForwardInputEvent(const WebInputEvent& input_event,
// after this line.
next_mouse_move_.reset();
- StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kHungRendererDelayMs));
+ in_flight_event_count_++;
+ StartHangMonitorTimeout(
+ TimeDelta::FromMilliseconds(hung_renderer_delay_ms_));
}
void RenderWidgetHost::ForwardTouchEvent(
@@ -770,6 +774,9 @@ void RenderWidgetHost::RendererExited(base::TerminationStatus status,
is_hidden_ = false;
is_accelerated_compositing_active_ = false;
+ // Reset this to ensure the hung renderer mechanism is working properly.
+ in_flight_event_count_ = 0;
+
if (view_) {
view_->RenderViewGone(status, exit_code);
view_ = NULL; // The View should be deleted by RenderViewGone.
@@ -1149,7 +1156,13 @@ void RenderWidgetHost::OnMsgInputEventAck(WebInputEvent::Type event_type,
UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta);
// Cancel pending hung renderer checks since the renderer is responsive.
- StopHangMonitorTimeout();
+ if (--in_flight_event_count_ == 0 ||
+ !CommandLine::ForCurrentProcess()->HasSwitch(
darin (slow to review) 2012/01/24 20:06:56 I still don't quite understand the need for checki
+ switches::kEnableThreadedCompositing)) {
+ // TODO: don't check for kEnableThreadedCompositing when
+ // the compositor thread is used by default.
+ StopHangMonitorTimeout();
+ }
int type = static_cast<int>(event_type);
if (type < WebInputEvent::Undefined) {
« no previous file with comments | « content/browser/renderer_host/render_widget_host.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