diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-16 14:51:15 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-16 14:51:15 +0200 |
commit | 4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26 (patch) | |
tree | 7bb9ad7e31c24d1cf1707e03e6f1a80f6d033951 /Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp | |
parent | 3977e3d2f72f7fe2c887c1ec0e0c342e1d169f42 (diff) | |
download | qtwebkit-4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26.tar.gz |
Imported WebKit commit 953baa67aa07087b6ecd4199351ec554c724e27d (http://svn.webkit.org/repository/webkit/trunk@122676)
Diffstat (limited to 'Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp')
-rw-r--r-- | Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp b/Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp index 3b0b5a751..d9f96fa1e 100644 --- a/Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp +++ b/Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp @@ -20,39 +20,40 @@ #include "GCActivityCallback.h" #include "Heap.h" +#include "JSGlobalData.h" #include <BlackBerryPlatformMemory.h> namespace JSC { +static const size_t bytesWorthGC = 4 * 1024 * 1024; + DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap) : GCActivityCallback(heap->globalData()) { } -DefaultGCActivityCallback::doWork() +void DefaultGCActivityCallback::doWork() { + m_globalData->heap.collect(Heap::DoNotSweep); } void DefaultGCActivityCallback::didAllocate(size_t bytesAllocated) { - if (!BlackBerry::Platform::isMemoryLow()) - return; - - if (bytesAllocated < 1 * 1024 * 1024) + if (bytesAllocated < bytesWorthGC || m_timer.started()) return; - if (m_globalData->heap.isBusy() || !m_globalData->heap.isSafeToCollect()) - return; - - m_globalData->heap.collect(Heap::DoNotSweep); + // Try using ~5% CPU time. + m_timer.start(m_globalData->heap.lastGCLength() * 20); } void DefaultGCActivityCallback::willCollect() { + cancel(); } void DefaultGCActivityCallback::cancel() { + m_timer.stop(); } } |