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 ea1cac8a5370887ea9fc37db2f0311b55cbc767c..5eaa53cef4f593e56f2cadbb90b61d780e024512 100644 |
| --- a/content/browser/renderer_host/render_widget_host_impl.cc |
| +++ b/content/browser/renderer_host/render_widget_host_impl.cc |
| @@ -961,6 +961,8 @@ bool RenderWidgetHostImpl::ScheduleComposite() { |
| void RenderWidgetHostImpl::StartHangMonitorTimeout( |
| base::TimeDelta delay, |
| blink::WebInputEvent::Type event_type) { |
| + if (hang_start_time_.is_null()) |
| + hang_start_time_ = TimeTicks::Now(); |
| if (!hang_monitor_timeout_) |
| return; |
| if (!hang_monitor_timeout_->IsRunning()) |
| @@ -970,10 +972,14 @@ void RenderWidgetHostImpl::StartHangMonitorTimeout( |
| } |
| void RenderWidgetHostImpl::RestartHangMonitorTimeoutIfNecessary() { |
| - if (!hang_monitor_timeout_) |
| - return; |
| - if (in_flight_event_count_ > 0 && !is_hidden_) |
| - hang_monitor_timeout_->Restart(hung_renderer_delay_); |
| + if (in_flight_event_count_ > 0 && !is_hidden_) { |
| + if (!hang_start_time_.is_null()) |
|
Ilya Sherman
2017/03/24 21:16:19
nit: Please use curly braces, since the body of th
|
| + UMA_HISTOGRAM_TIMES("MPArch.RWH_HangMonitorUnresponsive", |
| + TimeTicks::Now() - hang_start_time_); |
| + hang_start_time_ = TimeTicks::Now(); |
| + if (hang_monitor_timeout_) |
| + hang_monitor_timeout_->Restart(hung_renderer_delay_); |
| + } |
| } |
| void RenderWidgetHostImpl::DisableHangMonitorForTesting() { |
| @@ -982,6 +988,10 @@ void RenderWidgetHostImpl::DisableHangMonitorForTesting() { |
| } |
| void RenderWidgetHostImpl::StopHangMonitorTimeout() { |
| + if (!hang_start_time_.is_null()) |
| + UMA_HISTOGRAM_TIMES("MPArch.RWH_HangMonitorUnresponsive", |
| + TimeTicks::Now() - hang_start_time_); |
| + hang_start_time_ = TimeTicks(); |
|
Ilya Sherman
2017/03/24 21:16:19
Could you please factor out these four lines of sh
|
| if (hang_monitor_timeout_) |
| hang_monitor_timeout_->Stop(); |
| RendererIsResponsive(); |