Timer scheduling should be based off the monotonic clock
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jul 2011 20:38:42 +0000 (20:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jul 2011 20:38:42 +0000 (20:38 +0000)
commit4cb73e224440c9c81d76ee368c3fadc658be496b
treeb470361f09c088f69dfae8cf4e3d745d5b825a29
parent8fb5867a2bb9f83ffbf3edb7ac7611366310a141
Timer scheduling should be based off the monotonic clock
https://bugs.webkit.org/show_bug.cgi?id=64544

Patch by James Robinson <jamesr@chromium.org> on 2011-07-18
Reviewed by Darin Adler.

Source/JavaScriptCore:

Switches ThreadCondition::timedWait and related utility functions from currentTime() to
monotonicallyIncreasingTime().

Add WTF::monotonicallyIncreasingTime() to list of exported functions so it can be accessed from WebCore/WebKit.

* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* wtf/ThreadingPthreads.cpp:
(WTF::ThreadCondition::timedWait):
* wtf/ThreadingWin.cpp:
(WTF::absoluteTimeToWaitTimeoutInterval):
* wtf/gtk/ThreadingGtk.cpp:
(WTF::ThreadCondition::timedWait):
* wtf/qt/ThreadingQt.cpp:
(WTF::ThreadCondition::timedWait):

Source/WebCore:

Changes the Timer scheduling logic from using absolute values in terms of currentTime() to using relative
intervals in terms of monotonicallyIncreasingTime().  This provides better standards compliance, compatibility,
and predictability when the system clock is adjusted.

No automated tests since there is no way to modify the system clock from DRT.

* platform/SharedTimer.h:
(WebCore::MainThreadSharedTimer::setFireInterval):
* platform/ThreadTimers.cpp:
(WebCore::ThreadTimers::updateSharedTimer):
(WebCore::ThreadTimers::sharedTimerFiredInternal):
* platform/Timer.cpp:
(WebCore::TimerBase::start):
(WebCore::TimerBase::nextFireInterval):
* platform/android/SharedTimerAndroid.cpp:
(WebCore::setSharedTimerFireInterval):
* platform/brew/SharedTimerBrew.cpp:
(WebCore::setSharedTimerFireInterval):
* platform/chromium/PlatformBridge.h:
* platform/chromium/SharedTimerChromium.cpp:
(WebCore::setSharedTimerFireInterval):
* platform/efl/SharedTimerEfl.cpp:
(WebCore::addNewTimer):
(WebCore::setSharedTimerFireInterval):
* platform/gtk/SharedTimerGtk.cpp:
(WebCore::setSharedTimerFireInterval):
* platform/haiku/SharedTimerHaiku.cpp:
(WebCore::SharedTimerHaiku::start):
(WebCore::setSharedTimerFireInterval):
* platform/mac/SharedTimerMac.mm:
(WebCore::setSharedTimerFireInterval):
* platform/qt/SharedTimerQt.cpp:
(WebCore::SharedTimerQt::start):
(WebCore::setSharedTimerFireInterval):
* platform/win/SharedTimerWin.cpp:
(WebCore::setSharedTimerFireInterval):
* platform/wince/SharedTimerWinCE.cpp:
(WebCore::setSharedTimerFireInterval):
* platform/wx/SharedTimerWx.cpp:
(WebCore::setSharedTimerFireInterval):
* workers/WorkerRunLoop.cpp:
(WebCore::WorkerSharedTimer::setFireInterval):

Source/WebKit/chromium:

Renames setSharedTimerFireTime to setSharedTimerFireInterval to be consistent with WebCore.

* public/WebKitClient.h:
(WebKit::WebKitClient::setSharedTimerFireInterval):
* src/PlatformBridge.cpp:
(WebCore::PlatformBridge::setSharedTimerFireInterval):

Source/WebKit2:

Converts the WebKit2 RunLoop and CoreIPC timeouts to use monotonicallyIncreasingTime().

* Platform/CoreIPC/Connection.cpp:
(CoreIPC::Connection::waitForMessage):
(CoreIPC::Connection::waitForSyncReply):
* Platform/RunLoop.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@91206 268f45cc-cd09-0410-ab3c-d52691b4dbfc
30 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.exp
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/wtf/ThreadingPthreads.cpp
Source/JavaScriptCore/wtf/ThreadingWin.cpp
Source/JavaScriptCore/wtf/gtk/ThreadingGtk.cpp
Source/JavaScriptCore/wtf/qt/ThreadingQt.cpp
Source/WebCore/ChangeLog
Source/WebCore/platform/SharedTimer.h
Source/WebCore/platform/ThreadTimers.cpp
Source/WebCore/platform/Timer.cpp
Source/WebCore/platform/android/SharedTimerAndroid.cpp
Source/WebCore/platform/brew/SharedTimerBrew.cpp
Source/WebCore/platform/chromium/PlatformBridge.h
Source/WebCore/platform/chromium/SharedTimerChromium.cpp
Source/WebCore/platform/efl/SharedTimerEfl.cpp
Source/WebCore/platform/gtk/SharedTimerGtk.cpp
Source/WebCore/platform/haiku/SharedTimerHaiku.cpp
Source/WebCore/platform/mac/SharedTimerMac.mm
Source/WebCore/platform/qt/SharedTimerQt.cpp
Source/WebCore/platform/win/SharedTimerWin.cpp
Source/WebCore/platform/wince/SharedTimerWinCE.cpp
Source/WebCore/platform/wx/SharedTimerWx.cpp
Source/WebCore/workers/WorkerRunLoop.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebKitClient.h
Source/WebKit/chromium/src/PlatformBridge.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/CoreIPC/Connection.cpp
Source/WebKit2/Platform/RunLoop.h