diff options
author | Tor Arne Vestbø <tor.arne.vestbo@nokia.com> | 2009-08-03 17:59:14 (GMT) |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@nokia.com> | 2009-08-03 18:18:04 (GMT) |
commit | da7a979314978af43e9a53fe2494b87877e3139a (patch) | |
tree | 97d6800fbce8afa888aae7cc7ddfa8e0afacc945 /src | |
parent | ea1b369a3c90f26523d68d089f76f4cb96308d56 (diff) | |
download | Qt-da7a979314978af43e9a53fe2494b87877e3139a.zip Qt-da7a979314978af43e9a53fe2494b87877e3139a.tar.gz Qt-da7a979314978af43e9a53fe2494b87877e3139a.tar.bz2 |
Allow setting the checking interval for TimeoutChecker
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp | 7 | ||||
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp index 49839db..045a33a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.cpp @@ -56,8 +56,8 @@ namespace JSC { // Number of ticks before the first timeout check is done. static const int ticksUntilFirstCheck = 1024; -// Number of milliseconds between each timeout check. -static const int intervalBetweenChecks = 1000; +// Default number of milliseconds between each timeout check. +static const int defaultIntervalBetweenChecks = 1000; // Returns the time the current thread has spent executing, in milliseconds. static inline unsigned getCPUTime() @@ -104,6 +104,7 @@ static inline unsigned getCPUTime() TimeoutChecker::TimeoutChecker() : m_timeoutInterval(0) , m_startCount(0) + , m_intervalBetweenChecks(defaultIntervalBetweenChecks) { reset(); } @@ -139,7 +140,7 @@ bool TimeoutChecker::didTimeOut(ExecState* exec) // Adjust the tick threshold so we get the next checkTimeout call in the // interval specified in intervalBetweenChecks. - m_ticksUntilNextCheck = static_cast<unsigned>((static_cast<float>(intervalBetweenChecks) / timeDiff) * m_ticksUntilNextCheck); + m_ticksUntilNextCheck = static_cast<unsigned>((static_cast<float>(m_intervalBetweenChecks) / timeDiff) * m_ticksUntilNextCheck); // If the new threshold is 0 reset it to the default threshold. This can happen if the timeDiff is higher than the // preferred script check time interval. if (m_ticksUntilNextCheck == 0) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h index 5ef1542..1ebbc1d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/TimeoutChecker.h @@ -41,6 +41,7 @@ namespace JSC { virtual ~TimeoutChecker(); void setTimeoutInterval(unsigned timeoutInterval) { m_timeoutInterval = timeoutInterval; } + void setCheckInterval(unsigned checkInterval) { if (checkInterval) m_intervalBetweenChecks = checkInterval; } unsigned ticksUntilNextCheck() { return m_ticksUntilNextCheck; } @@ -67,6 +68,7 @@ namespace JSC { unsigned m_timeExecuting; unsigned m_startCount; unsigned m_ticksUntilNextCheck; + unsigned m_intervalBetweenChecks; }; } // namespace JSC |