summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/GCActivityCallback.cpp
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@digia.com>2013-03-22 15:31:08 +0100
committerSergio Ahumada <sergio.ahumada@digia.com>2013-03-22 15:31:08 +0100
commite8a56c51780cd3e3a0043c4f6a8849d4c2d87dd6 (patch)
tree85dc5ef1ce13d7e197c3bb3fd6f845ab7da93449 /Source/JavaScriptCore/runtime/GCActivityCallback.cpp
parent68753e64d1d606d7627fae83e05863d110226c15 (diff)
parent99783e2c7e917224da401ddbd33354c131b3a377 (diff)
downloadqtwebkit-e8a56c51780cd3e3a0043c4f6a8849d4c2d87dd6.tar.gz
Merge branch 'dev' into stable
This starts Qt 5.1 release cycle Conflicts: Source/sync.profile Change-Id: I570f2804b9e5baf6d2b5573d1030887866077124
Diffstat (limited to 'Source/JavaScriptCore/runtime/GCActivityCallback.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/GCActivityCallback.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/JavaScriptCore/runtime/GCActivityCallback.cpp b/Source/JavaScriptCore/runtime/GCActivityCallback.cpp
index 74cbdbaef..0c07b5e02 100644
--- a/Source/JavaScriptCore/runtime/GCActivityCallback.cpp
+++ b/Source/JavaScriptCore/runtime/GCActivityCallback.cpp
@@ -40,14 +40,15 @@
namespace JSC {
-#if USE(CF)
+#if USE(CF) || PLATFORM(QT)
const double gcTimeSlicePerMB = 0.01; // Percentage of CPU time we will spend to reclaim 1 MB
const double maxGCTimeSlice = 0.05; // The maximum amount of CPU time we want to use for opportunistic timer-triggered collections.
const double timerSlop = 2.0; // Fudge factor to avoid performance cost of resetting timer.
const double pagingTimeOut = 0.1; // Time in seconds to allow opportunistic timer to iterate over all blocks to see if the Heap is paged out.
-const CFTimeInterval hour = 60 * 60;
+const double hour = 60 * 60;
+#if USE(CF)
DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap)
: GCActivityCallback(heap->globalData(), CFRunLoopGetCurrent())
, m_delay(s_decade)
@@ -59,6 +60,13 @@ DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap, CFRunLoopRef ru
, m_delay(s_decade)
{
}
+#elif PLATFORM(QT)
+DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap)
+ : GCActivityCallback(heap->globalData())
+ , m_delay(hour)
+{
+}
+#endif
void DefaultGCActivityCallback::doWork()
{
@@ -78,6 +86,7 @@ void DefaultGCActivityCallback::doWork()
heap->collect(Heap::DoNotSweep);
}
+#if USE(CF)
void DefaultGCActivityCallback::scheduleTimer(double newDelay)
{
if (newDelay * timerSlop > m_delay)
@@ -92,6 +101,22 @@ void DefaultGCActivityCallback::cancelTimer()
m_delay = s_decade;
CFRunLoopTimerSetNextFireDate(m_timer.get(), CFAbsoluteTimeGetCurrent() + s_decade);
}
+#elif PLATFORM(QT)
+
+void DefaultGCActivityCallback::scheduleTimer(double newDelay)
+{
+ if (newDelay * timerSlop > m_delay)
+ return;
+ m_delay = newDelay;
+ m_timer.start(newDelay * 1000, this);
+}
+
+void DefaultGCActivityCallback::cancelTimer()
+{
+ m_delay = hour;
+ m_timer.stop();
+}
+#endif
void DefaultGCActivityCallback::didAllocate(size_t bytes)
{