Index: content/renderer/render_thread_impl.cc |
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
index 9e2a30923f6ef5d502fa6dacf5262a114a8e5936..2c424b17660e829c1401811f5f7c0c31669e4342 100644 |
--- a/content/renderer/render_thread_impl.cc |
+++ b/content/renderer/render_thread_impl.cc |
@@ -173,9 +173,7 @@ namespace content { |
namespace { |
const int64 kInitialIdleHandlerDelayMs = 1000; |
-const int64 kShortIdleHandlerDelayMs = 1000; |
const int64 kLongIdleHandlerDelayMs = 30*1000; |
-const int kIdleCPUUsageThresholdInPercents = 3; |
// Maximum allocation size allowed for image scaling filters that |
// require pre-scaling. Skia will fallback to a filter that doesn't |
@@ -1005,10 +1003,8 @@ void RenderThreadImpl::IdleHandler() { |
bool run_in_foreground_tab = (widget_count_ > hidden_widget_count_) && |
GetContentClient()->renderer()-> |
RunIdleHandlerWhenWidgetsHidden(); |
- if (run_in_foreground_tab) { |
- IdleHandlerInForegroundTab(); |
+ if (run_in_foreground_tab) |
return; |
- } |
base::allocator::ReleaseFreeMemory(); |
@@ -1050,42 +1046,6 @@ void RenderThreadImpl::IdleHandler() { |
FOR_EACH_OBSERVER(RenderProcessObserver, observers_, IdleNotification()); |
} |
-void RenderThreadImpl::IdleHandlerInForegroundTab() { |
- // Increase the delay in the same way as in IdleHandler, |
- // but make it periodic by reseting it once it is too big. |
- int64 new_delay_ms = idle_notification_delay_in_ms_ + |
- 1000000 / (idle_notification_delay_in_ms_ + 2000); |
- if (new_delay_ms >= kLongIdleHandlerDelayMs) |
- new_delay_ms = kShortIdleHandlerDelayMs; |
- |
- if (idle_notifications_to_skip_ > 0) { |
- idle_notifications_to_skip_--; |
- } 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) { |
- base::allocator::ReleaseFreeMemory(); |
- |
- bool finished_idle_work = true; |
- if (blink::mainThreadIsolate() && |
- !blink::mainThreadIsolate()->IdleNotification(idle_hint)) { |
- finished_idle_work = false; |
- } |
- if (!base::DiscardableMemory::ReduceMemoryUsage()) |
reveman
2014/09/25 13:34:17
where is this moved?
jochen (gone - plz use gerrit)
2014/09/25 14:18:28
nowhere. In our experiments, the idle handler is a
reveman
2014/09/25 15:03:41
This call will discard memory that has not been us
jochen (gone - plz use gerrit)
2014/09/25 15:08:36
so just postTask this call every 30s should be fin
reveman
2014/09/25 16:44:49
Maybe. Is there not a better idle signal we can ho
|
- 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); |
-} |
- |
int64 RenderThreadImpl::GetIdleNotificationDelayInMs() const { |
return idle_notification_delay_in_ms_; |
} |