Ignore:
Timestamp:
Jul 18, 2011, 1:38:42 PM (14 years ago)
Author:
[email protected]
Message:

Timer scheduling should be based off the monotonic clock
https://bugs.webkit.org/show_bug.cgi?id=64544

Patch by James Robinson <[email protected]> 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.

(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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/wtf/ThreadingWin.cpp

    r78597 r91206  
    484484DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime)
    485485{
    486     double currentTime = WTF::currentTime();
     486    double currentTime = monotonicallyIncreasingTime();
    487487
    488488    // Time is in the past - return immediately.
Note: See TracChangeset for help on using the changeset viewer.