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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 9244007: Provide a hint for the idle notification handler. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Don't clamp the hint and reword comments. Created 8 years, 11 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
« 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/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 6dd026c31e925f139a192013df44f1db078e2704..d5fc6d79a56993d2d9e96c043ac274c59dafd2a3 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -626,8 +626,11 @@ void RenderThreadImpl::IdleHandlerInForegroundTab() {
} else {
int cpu_usage = 0;
Send(new ViewHostMsg_GetCPUUsage(&cpu_usage));
+ // Idle notification hint roughly specifies the expected duration of the
+ // idle pause. We set it proportional to the idle timer delay.
+ int idle_hint = static_cast<int>(new_delay_ms / 10);
if (cpu_usage < kIdleCPUUsageThresholdInPercents &&
- v8::V8::IdleNotification()) {
+ v8::V8::IdleNotification(idle_hint)) {
// V8 finished collecting garbage.
new_delay_ms = kLongIdleHandlerDelayMs;
}
« 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