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..30a81853c9ce2f4190a781ff7ac8241d5dcc6545 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), |
+ 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)); |
+ RecordInputEvent(); |
+ StartHangMonitorTimeout( |
+ TimeDelta::FromMilliseconds(hung_renderer_delay_ms_)); |
} |
void RenderWidgetHost::ForwardTouchEvent( |
@@ -1149,7 +1153,8 @@ 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 (RecordInputEventAck()) |
+ StopHangMonitorTimeout(); |
int type = static_cast<int>(event_type); |
if (type < WebInputEvent::Undefined) { |
@@ -1525,6 +1530,27 @@ bool RenderWidgetHost::GotResponseToLockMouseRequest(bool allowed) { |
} |
} |
+void RenderWidgetHost::RecordInputEvent() { |
+ // TODO: remove this check once the compositor thread |
+ // is used by default. |
+ if (!CommandLine::ForCurrentProcess()->HasSwitch( |
darin (slow to review)
2012/01/24 17:58:01
I'm not sure it is a good idea to check command li
|
+ switches::kEnableThreadedCompositing)) { |
+ return; |
+ } |
+ event_count_++; |
+} |
+ |
+bool RenderWidgetHost::RecordInputEventAck() { |
+ // TODO: remove this check once the compositor thread |
+ // is used by default. |
+ if (!CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableThreadedCompositing)) { |
+ return true; |
+ } |
+ return --event_count_ == 0; |
darin (slow to review)
2012/01/24 17:58:01
The name of this function, RecordInputEventAck, do
|
+} |
+ |
+ |
// static |
void RenderWidgetHost::AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id) { |
GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |