summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_thread.cc
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 22:10:22 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 22:10:22 +0000
commit20d9685da5bcbfb097882b5d797f34637d9fe792 (patch)
tree012f8dd39182c2df1b1f223fef63cb8e2c8456a4 /chrome/renderer/render_thread.cc
parent97e3edc23314c476859c22c8db601f9b3dec552d (diff)
downloadchromium_src-20d9685da5bcbfb097882b5d797f34637d9fe792.zip
chromium_src-20d9685da5bcbfb097882b5d797f34637d9fe792.tar.gz
chromium_src-20d9685da5bcbfb097882b5d797f34637d9fe792.tar.bz2
Revert "Issue 172109: Enable scavenging in RenderThread::IdleHandler."
This reverts commit r26264. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_thread.cc')
-rw-r--r--chrome/renderer/render_thread.cc40
1 files changed, 18 insertions, 22 deletions
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index e7c04ed..fd076ba 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -48,7 +48,6 @@
#include "webkit/extensions/v8/gears_extension.h"
#include "webkit/extensions/v8/interval_extension.h"
#include "webkit/extensions/v8/playback_extension.h"
-#include "third_party/tcmalloc/google/malloc_extension.h"
#if defined(OS_WIN)
#include <windows.h>
@@ -460,29 +459,26 @@ void RenderThread::IdleHandler() {
if (!widget_count_ || hidden_widget_count_ < widget_count_)
return;
-#if defined(OS_WIN)
- MallocExtension::instance()->Scavenge();
-#endif
+ if (v8::V8::IsDead())
+ return;
- if (!v8::V8::IsDead()) {
- LOG(INFO) << "RenderThread calling v8 IdleNotification for " << this;
- v8::V8::IdleNotification(false);
- }
+ LOG(INFO) << "RenderThread calling v8 IdleNotification for " << this;
- // Schedule next invocation.
- // Dampen the delay using the algorithm:
- // delay = delay + 1 / (delay + 2)
- // Using floor(delay) has a dampening effect such as:
- // 1s, 1, 1, 2, 2, 2, 2, 3, 3, ...
- // Note that idle_notification_delay_in_s_ would be reset to
- // kInitialIdleHandlerDelayS in RenderThread::WidgetHidden.
- idle_notification_delay_in_s_ +=
- 1.0 / (idle_notification_delay_in_s_ + 2.0);
-
- // Schedule the next timer.
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- task_factory_->NewRunnableMethod(&RenderThread::IdleHandler),
- static_cast<int64>(floor(idle_notification_delay_in_s_)) * 1000);
+ // When V8::IdleNotification returns true, it means that it has cleaned up
+ // as much as it can. There is no point in continuing to call it.
+ if (!v8::V8::IdleNotification(false)) {
+ // Dampen the delay using the algorithm:
+ // delay = delay + 1 / (delay + 2)
+ // Using floor(delay) has a dampening effect such as:
+ // 1s, 1, 1, 2, 2, 2, 2, 3, 3, ...
+ idle_notification_delay_in_s_ +=
+ 1.0 / (idle_notification_delay_in_s_ + 2.0);
+
+ // Schedule the next timer.
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,
+ task_factory_->NewRunnableMethod(&RenderThread::IdleHandler),
+ static_cast<int64>(floor(idle_notification_delay_in_s_)) * 1000);
+ }
}
void RenderThread::OnExtensionMessageInvoke(const std::string& function_name,