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

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

Issue 8510038: Fix hung renderer timer code in RenderWidgetHost (task spam bug) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 9 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 404ff86093ef97319b1da921c70cda7dfbc631d1..cfe43a46ac1fba2064c4168edd6daa1e99514439 100644
--- a/content/browser/renderer_host/render_widget_host.cc
+++ b/content/browser/renderer_host/render_widget_host.cc
@@ -506,19 +506,26 @@ void RenderWidgetHost::StartHangMonitorTimeout(TimeDelta delay) {
return;
}
- // If we already have a timer that will expire at or before the given delay,
- // then we have nothing more to do now. If we have set our end time to null
- // by calling StopHangMonitorTimeout, though, we will need to restart the
- // timer.
+ // Set time_when_considered_hung_ if it's null.
+ Time requested_end_time = Time::Now() + delay;
+ if (time_when_considered_hung_.is_null())
+ time_when_considered_hung_ = requested_end_time;
+
+ // If we already have a timer with the same or shorter duration, then we can
+ // wait for it to finish.
if (hung_renderer_timer_.IsRunning() &&
- hung_renderer_timer_.GetCurrentDelay() <= delay &&
- !time_when_considered_hung_.is_null()) {
+ hung_renderer_timer_.GetCurrentDelay() <= delay) {
+ // If time_when_considered_hung_ was null, this timer may fire early.
+ // CheckRendererIsUnresponsive handles that by calling
+ // StartHangMonitorTimeout with the remaining time.
+ // If time_when_considered_hung_ was non-null, it means we still haven't
+ // heard from the renderer so we leave time_when_considered_hung_ as is.
return;
}
// Either the timer is not yet running, or we need to adjust the timer to
// fire sooner.
- time_when_considered_hung_ = Time::Now() + delay;
+ time_when_considered_hung_ = requested_end_time;
hung_renderer_timer_.Stop();
hung_renderer_timer_.Start(FROM_HERE, delay, this,
&RenderWidgetHost::CheckRendererIsUnresponsive);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698