summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/renderer/render_thread_impl.cc19
-rw-r--r--content/renderer/render_thread_impl.h1
2 files changed, 17 insertions, 3 deletions
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index bf37dc2..1ddfa29 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -332,6 +332,7 @@ void RenderThreadImpl::Init() {
// In single process the single process is all there is.
suspend_webkit_shared_timer_ = true;
notify_webkit_of_modal_loop_ = true;
+ webkit_shared_timer_suspended_ = false;
widget_count_ = 0;
hidden_widget_count_ = 0;
idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs;
@@ -820,7 +821,13 @@ void RenderThreadImpl::IdleHandler() {
base::allocator::ReleaseFreeMemory();
- v8::V8::IdleNotification();
+ // Continue the idle timer if the webkit shared timer is not suspended or
+ // something is left to do.
+ bool continue_timer = !webkit_shared_timer_suspended_;
+
+ if (!v8::V8::IdleNotification()) {
+ continue_timer = true;
+ }
// Schedule next invocation.
// Dampen the delay using the algorithm (if delay is in seconds):
@@ -833,8 +840,13 @@ void RenderThreadImpl::IdleHandler() {
// delay_ms = delay_ms + 1000*1000 / (delay_ms + 2000).
// Note that idle_notification_delay_in_ms_ would be reset to
// kInitialIdleHandlerDelayMs in RenderThreadImpl::WidgetHidden.
- ScheduleIdleHandler(idle_notification_delay_in_ms_ +
- 1000000 / (idle_notification_delay_in_ms_ + 2000));
+ if (continue_timer) {
+ ScheduleIdleHandler(idle_notification_delay_in_ms_ +
+ 1000000 / (idle_notification_delay_in_ms_ + 2000));
+
+ } else {
+ idle_timer_.Stop();
+ }
FOR_EACH_OBSERVER(RenderProcessObserver, observers_, IdleNotification());
}
@@ -1310,6 +1322,7 @@ void RenderThreadImpl::OnSetWebKitSharedTimersSuspended(bool suspend) {
} else {
webkit_platform_support_->ResumeSharedTimer();
}
+ webkit_shared_timer_suspended_ = suspend;
}
}
#endif
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 05b18f2..3670165 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -449,6 +449,7 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
bool suspend_webkit_shared_timer_;
bool notify_webkit_of_modal_loop_;
+ bool webkit_shared_timer_suspended_;
// The following flag is used to control layout test specific behavior.
bool layout_test_mode_;