| Index: content/renderer/render_thread_impl.cc
|
| diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
|
| index 6e124b321bd57e00648a24a0f89601475a47487a..8cd1c31d3e5e75d05e8bd89318cb3b52e28848ef 100644
|
| --- a/content/renderer/render_thread_impl.cc
|
| +++ b/content/renderer/render_thread_impl.cc
|
| @@ -899,6 +899,9 @@ void RenderThreadImpl::IdleHandler() {
|
| if (!v8::V8::IdleNotification()) {
|
| continue_timer = true;
|
| }
|
| + if (!base::DiscardableMemory::IdleNotification()) {
|
| + continue_timer = true;
|
| + }
|
|
|
| // Schedule next invocation.
|
| // Dampen the delay using the algorithm (if delay is in seconds):
|
| @@ -940,10 +943,17 @@ void RenderThreadImpl::IdleHandlerInForegroundTab() {
|
| int idle_hint = static_cast<int>(new_delay_ms / 10);
|
| if (cpu_usage < kIdleCPUUsageThresholdInPercents) {
|
| base::allocator::ReleaseFreeMemory();
|
| - if (v8::V8::IdleNotification(idle_hint)) {
|
| - // V8 finished collecting garbage.
|
| +
|
| + bool finished_idle_work = true;
|
| + if (!v8::V8::IdleNotification(idle_hint))
|
| + finished_idle_work = false;
|
| + if (!base::DiscardableMemory::IdleNotification())
|
| + finished_idle_work = false;
|
| +
|
| + // V8 finished collecting garbage and discardable memory system has no
|
| + // more idle work left.
|
| + if (finished_idle_work)
|
| new_delay_ms = kLongIdleHandlerDelayMs;
|
| - }
|
| }
|
| }
|
| ScheduleIdleHandler(new_delay_ms);
|
|
|