Skip to content
  • commit-queue@webkit.org's avatar
    Timer scheduling should be based off the monotonic clock · 3af8d9f0
    commit-queue@webkit.org authored
    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: http://svn.webkit.org/repository/webkit/trunk@91206 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    3af8d9f0