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

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

Issue 10008015: Fixing a problem, where a hung renderer process is not killed when navigating away (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes based on feedback and new test Created 8 years, 8 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 7476989ec27f02a40b198ad4f5fde1eaa86d9125..479f3ebfc26fe83c12097aa5b17d0c4d98fc32fc 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -628,9 +628,13 @@ void RenderWidgetHostImpl::StartHangMonitorTimeout(TimeDelta delay) {
return;
}
- // Set time_when_considered_hung_ if it's null.
+ // Set time_when_considered_hung_ if it's null. Otherwise, update
+ // time_when_considered_hung_ if the caller's request is sooner than the
+ // existing one. This will have the side effect that the existing timeout will
+ // be forgotten.
Time requested_end_time = Time::Now() + delay;
- if (time_when_considered_hung_.is_null())
+ if (time_when_considered_hung_.is_null() ||
+ time_when_considered_hung_ > requested_end_time)
time_when_considered_hung_ = requested_end_time;
// If we already have a timer with the same or shorter duration, then we can
@@ -845,7 +849,7 @@ void RenderWidgetHostImpl::ForwardInputEvent(const WebInputEvent& input_event,
// after this line.
next_mouse_move_.reset();
- in_flight_event_count_++;
+ increment_in_flight_event_count();
StartHangMonitorTimeout(
TimeDelta::FromMilliseconds(hung_renderer_delay_ms_));
}
@@ -1287,7 +1291,7 @@ void RenderWidgetHostImpl::OnMsgInputEventAck(WebInputEvent::Type event_type,
UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta);
// Cancel pending hung renderer checks since the renderer is responsive.
- if (--in_flight_event_count_ == 0)
+ if (decrement_in_flight_event_count() == 0)
StopHangMonitorTimeout();
int type = static_cast<int>(event_type);

Powered by Google App Engine
This is Rietveld 408576698