<https://webkit.org/b/119785> Replace currentTime() with monotonicallyIncreasingTime...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Aug 2013 19:33:59 +0000 (19:33 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Aug 2013 19:33:59 +0000 (19:33 +0000)
Patch by Arunprasad Rajkumar <arurajku@cisco.com> on 2013-08-16
Reviewed by Alexey Proskuryakov.

Source/WebCore:

WTF::currentTime() is prone to DST changes and NTP adjustments, so use
WTF::monotonicallyIncreasingTime() to measure elapsed time.

* Modules/filesystem/FileWriter.cpp:
(WebCore::FileWriter::didWrite):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::elapsedTime):
(WebCore::Document::resetLastHandledUserGestureTimestamp):
* dom/Element.cpp:
(WebCore::Element::setActive):
* fileapi/FileReader.cpp:
(WebCore::FileReader::didReceiveData):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::startProgressEventTimer):
(WebCore::HTMLMediaElement::progressEventTimerFired):
(WebCore::HTMLMediaElement::refreshCachedTime):
(WebCore::HTMLMediaElement::invalidateCachedTime):
(WebCore::HTMLMediaElement::currentTime):
(WebCore::HTMLMediaElement::startPlaybackProgressTimer):
(WebCore::HTMLMediaElement::scheduleTimeupdateEvent):
* html/HTMLMediaElement.h:
* html/HTMLPlugInImageElement.cpp:
(WebCore::documentHadRecentUserGesture):
* html/MediaController.cpp:
(MediaController::scheduleTimeupdateEvent):
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::pumpPendingSpeculations):
* html/parser/HTMLParserScheduler.h:
(WebCore::HTMLParserScheduler::checkForYieldBeforeToken):
* inspector/InspectorCSSAgent.cpp:
(WebCore::SelectorProfile::SelectorProfile):
(WebCore::SelectorProfile::totalMatchingTimeMs):
(WebCore::SelectorProfile::startSelector):
(WebCore::SelectorProfile::commitSelector):
(WebCore::SelectorProfile::commitSelectorTime):
* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::willProcessTask):
(WebCore::InspectorProfilerAgent::didProcessTask):
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::timestamp):
* inspector/TimelineTraceEventProcessor.cpp:
(WebCore::TimelineTraceEventProcessor::processEventOnAnyThread):
* page/FrameView.cpp:
(WebCore::FrameView::adjustedDeferredRepaintDelay):
(WebCore::FrameView::paintContents):
* platform/ClockGeneric.cpp:
(ClockGeneric::now):
* platform/ScrollAnimatorNone.cpp:
(WebCore::ScrollAnimatorNone::scroll):
(WebCore::ScrollAnimatorNone::animationTimerFired):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::ImageBuffer):
(WebCore::ImageBuffer::flushContextIfNecessary):
(WebCore::ImageBuffer::flushContext):
(WebCore::ImageBuffer::copyNativeImage):

Source/WTF:

WTF::currentTime() is prone to DST changes and NTP adjustments, so use
WTF::monotonicallyIncreasingTime() to measure elapsed time.

* wtf/CurrentTime.h:
(WTF::monotonicallyIncreasingTimeMS): Added mille second version of monotonic time API.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154201 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/CurrentTime.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/filesystem/FileWriter.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/fileapi/FileReader.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/html/MediaController.cpp
Source/WebCore/html/parser/HTMLDocumentParser.cpp
Source/WebCore/html/parser/HTMLParserScheduler.h
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorProfilerAgent.cpp
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/TimelineTraceEventProcessor.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/platform/ClockGeneric.cpp
Source/WebCore/platform/ScrollAnimatorNone.cpp
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp

index 72fbbbf..6b0ac29 100644 (file)
@@ -1,3 +1,15 @@
+2013-08-16  Arunprasad Rajkumar  <arurajku@cisco.com>
+
+        <https://webkit.org/b/119785> Replace currentTime() with monotonicallyIncreasingTime() in WebCore
+
+        Reviewed by Alexey Proskuryakov.
+
+        WTF::currentTime() is prone to DST changes and NTP adjustments, so use
+        WTF::monotonicallyIncreasingTime() to measure elapsed time.
+
+        * wtf/CurrentTime.h:
+        (WTF::monotonicallyIncreasingTimeMS): Added mille second version of monotonic time API.
+
 2013-08-15  Filip Pizlo  <fpizlo@apple.com>
 
         refCount() of a StringImpl could be zero if it's static; in that case we shouldn't report extra memory cost
index 2a60eda..24b2a30 100644 (file)
@@ -39,6 +39,8 @@ namespace WTF {
 // Returns the current UTC time in seconds, counted from January 1, 1970.
 // Precision varies depending on platform but is usually as good or better
 // than a millisecond.
+// Use this function only if wall clock time is needed. For elapsed time
+// measurement use monotonicallyIncreasingTime() instead.
 WTF_EXPORT_PRIVATE double currentTime();
 
 // Same thing, in milliseconds.
@@ -49,8 +51,15 @@ inline double currentTimeMS()
 
 // Provides a monotonically increasing time in seconds since an arbitrary point in the past.
 // On unsupported platforms, this function only guarantees the result will be non-decreasing.
+// Result of this function increases monotonically even when clock time goes back due to
+// DST changes or NTP adjustments, so it better suits for elapsed time measurement.
 WTF_EXPORT_PRIVATE double monotonicallyIncreasingTime();
 
+inline double monotonicallyIncreasingTimeMS()
+{
+    return monotonicallyIncreasingTime() * 1000.0;
+}
+
 // Returns the current CPU time of the current thread in seconds.
 // Precision varies depending on platform but is usually as good or better
 // than a millisecond.
@@ -64,6 +73,7 @@ WTF_EXPORT_PRIVATE double currentCPUTimeMS();
 using WTF::currentTime;
 using WTF::currentTimeMS;
 using WTF::monotonicallyIncreasingTime;
+using WTF::monotonicallyIncreasingTimeMS;
 using WTF::currentCPUTime;
 
 #endif // CurrentTime_h
index 881d008..81eede1 100644 (file)
@@ -1,3 +1,67 @@
+2013-08-16  Arunprasad Rajkumar  <arurajku@cisco.com>
+
+        <https://webkit.org/b/119785> Replace currentTime() with monotonicallyIncreasingTime() in WebCore
+
+        Reviewed by Alexey Proskuryakov.
+
+        WTF::currentTime() is prone to DST changes and NTP adjustments, so use
+        WTF::monotonicallyIncreasingTime() to measure elapsed time.
+        
+        * Modules/filesystem/FileWriter.cpp:
+        (WebCore::FileWriter::didWrite):
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::elapsedTime):
+        (WebCore::Document::resetLastHandledUserGestureTimestamp):
+        * dom/Element.cpp:
+        (WebCore::Element::setActive):
+        * fileapi/FileReader.cpp:
+        (WebCore::FileReader::didReceiveData):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::HTMLMediaElement):
+        (WebCore::HTMLMediaElement::startProgressEventTimer):
+        (WebCore::HTMLMediaElement::progressEventTimerFired):
+        (WebCore::HTMLMediaElement::refreshCachedTime):
+        (WebCore::HTMLMediaElement::invalidateCachedTime):
+        (WebCore::HTMLMediaElement::currentTime):
+        (WebCore::HTMLMediaElement::startPlaybackProgressTimer):
+        (WebCore::HTMLMediaElement::scheduleTimeupdateEvent):
+        * html/HTMLMediaElement.h:
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::documentHadRecentUserGesture):
+        * html/MediaController.cpp:
+        (MediaController::scheduleTimeupdateEvent):
+        * html/parser/HTMLDocumentParser.cpp:
+        (WebCore::HTMLDocumentParser::pumpPendingSpeculations):
+        * html/parser/HTMLParserScheduler.h:
+        (WebCore::HTMLParserScheduler::checkForYieldBeforeToken):
+        * inspector/InspectorCSSAgent.cpp:
+        (WebCore::SelectorProfile::SelectorProfile):
+        (WebCore::SelectorProfile::totalMatchingTimeMs):
+        (WebCore::SelectorProfile::startSelector):
+        (WebCore::SelectorProfile::commitSelector):
+        (WebCore::SelectorProfile::commitSelectorTime):
+        * inspector/InspectorProfilerAgent.cpp:
+        (WebCore::InspectorProfilerAgent::willProcessTask):
+        (WebCore::InspectorProfilerAgent::didProcessTask):
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::timestamp):
+        * inspector/TimelineTraceEventProcessor.cpp:
+        (WebCore::TimelineTraceEventProcessor::processEventOnAnyThread):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::adjustedDeferredRepaintDelay):
+        (WebCore::FrameView::paintContents):
+        * platform/ClockGeneric.cpp:
+        (ClockGeneric::now):
+        * platform/ScrollAnimatorNone.cpp:
+        (WebCore::ScrollAnimatorNone::scroll):
+        (WebCore::ScrollAnimatorNone::animationTimerFired):
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        (WebCore::ImageBuffer::ImageBuffer):
+        (WebCore::ImageBuffer::flushContextIfNecessary):
+        (WebCore::ImageBuffer::flushContext):
+        (WebCore::ImageBuffer::copyNativeImage):
+
 2013-08-16  peavo@outlook.com  <peavo@outlook.com>
 
         <https://webkit.org/b/119891> [WinCairo] Compile error.
index 841e69b..38ab598 100644 (file)
@@ -203,7 +203,7 @@ void FileWriter::didWrite(long long bytes, bool complete)
     int numAborts = m_numAborts;
     // We could get an abort in the handler for this event. If we do, it's
     // already handled the cleanup and signalCompletion call.
-    double now = currentTimeMS();
+    double now = monotonicallyIncreasingTimeMS();
     if (complete || !m_lastProgressNotificationTimeMS || (now - m_lastProgressNotificationTimeMS > progressNotificationIntervalMS)) {
         m_lastProgressNotificationTimeMS = now;
         fireEvent(eventNames().progressEvent);
index b14a7d6..f1d8e99 100644 (file)
@@ -424,7 +424,7 @@ Document::Document(Frame* frame, const KURL& url, unsigned documentClasses)
     , m_cssTarget(0)
     , m_processingLoadEvent(false)
     , m_loadEventFinished(false)
-    , m_startTime(currentTime())
+    , m_startTime(monotonicallyIncreasingTimeMS())
     , m_overMinimumLayoutThreshold(false)
     , m_scriptRunner(ScriptRunner::create(this))
     , m_xmlVersion(ASCIILiteral("1.0"))
@@ -2497,7 +2497,7 @@ int Document::minimumLayoutDelay()
 
 int Document::elapsedTime() const
 {
-    return static_cast<int>((currentTime() - m_startTime) * 1000);
+    return static_cast<int>(monotonicallyIncreasingTimeMS() - m_startTime);
 }
 
 void Document::write(const SegmentedString& text, Document* ownerDocument)
@@ -5615,7 +5615,7 @@ void Document::didRemoveEventTargetNode(Node* handler)
 
 void Document::resetLastHandledUserGestureTimestamp()
 {
-    m_lastHandledUserGestureTimestamp = currentTime();
+    m_lastHandledUserGestureTimestamp = monotonicallyIncreasingTime();
 }
 
 HTMLIFrameElement* Document::seamlessParentIFrame() const
index a8ece1c..1e50b06 100644 (file)
@@ -486,7 +486,7 @@ void Element::setActive(bool flag, bool pause)
         // "up" state. Once you assume this, you can just delay for 100ms - that time (assuming that after you
         // leave this method, it will be about that long before the flush of the up state happens again).
 #ifdef HAVE_FUNC_USLEEP
-        double startTime = currentTime();
+        double startTime = monotonicallyIncreasingTime();
 #endif
 
         document()->updateStyleIfNeeded();
@@ -498,7 +498,7 @@ void Element::setActive(bool flag, bool pause)
         // FIXME: Come up with a less ridiculous way of doing this.
 #ifdef HAVE_FUNC_USLEEP
         // Now pause for a small amount of time (1/10th of a second from before we repainted in the pressed state)
-        double remainingTime = 0.1 - (currentTime() - startTime);
+        double remainingTime = 0.1 - (monotonicallyIncreasingTime() - startTime);
         if (remainingTime > 0)
             usleep(static_cast<useconds_t>(remainingTime * 1000000.0));
 #endif
index f696775..6b1c86f 100644 (file)
@@ -204,7 +204,7 @@ void FileReader::didStartLoading()
 void FileReader::didReceiveData()
 {
     // Fire the progress event at least every 50ms.
-    double now = currentTimeMS();
+    double now = monotonicallyIncreasingTimeMS();
     if (!m_lastProgressNotificationTimeMS)
         m_lastProgressNotificationTimeMS = now;
     else if (now - m_lastProgressNotificationTimeMS > progressNotificationIntervalMS) {
index 890d14b..6830fca 100644 (file)
@@ -267,7 +267,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
     , m_volume(1.0f)
     , m_lastSeekTime(0)
     , m_previousProgressTime(numeric_limits<double>::max())
-    , m_lastTimeUpdateEventWallTime(0)
+    , m_clockTimeAtLastUpdateEvent(0)
     , m_lastTimeUpdateEventMovieTime(numeric_limits<double>::max())
     , m_loadState(WaitingForSource)
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
@@ -278,8 +278,8 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
     , m_displayMode(Unknown)
     , m_processingMediaPlayerCallback(0)
     , m_cachedTime(MediaPlayer::invalidTime())
-    , m_cachedTimeWallClockUpdateTime(0)
-    , m_minimumWallClockTimeToCacheMediaTime(0)
+    , m_clockTimeAtLastCachedTimeUpdate(0)
+    , m_minimumClockTimeToUpdateCachedTime(0)
     , m_fragmentStartTime(MediaPlayer::invalidTime())
     , m_fragmentEndTime(MediaPlayer::invalidTime())
     , m_pendingActionFlags(0)
@@ -1559,7 +1559,7 @@ void HTMLMediaElement::startProgressEventTimer()
     if (m_progressEventTimer.isActive())
         return;
 
-    m_previousProgressTime = WTF::currentTime();
+    m_previousProgressTime = monotonicallyIncreasingTime();
     // 350ms is not magic, it is in the spec!
     m_progressEventTimer.startRepeating(0.350);
 }
@@ -2070,7 +2070,7 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*)
     if (m_networkState != NETWORK_LOADING)
         return;
 
-    double time = WTF::currentTime();
+    double time = monotonicallyIncreasingTime();
     double timedelta = time - m_previousProgressTime;
 
     if (m_player->didLoadingProgress()) {
@@ -2260,7 +2260,7 @@ bool HTMLMediaElement::seeking() const
 void HTMLMediaElement::refreshCachedTime() const
 {
     m_cachedTime = m_player->currentTime();
-    m_cachedTimeWallClockUpdateTime = WTF::currentTime();
+    m_clockTimeAtLastCachedTimeUpdate = monotonicallyIncreasingTime();
 }
 
 void HTMLMediaElement::invalidateCachedTime()
@@ -2272,7 +2272,7 @@ void HTMLMediaElement::invalidateCachedTime()
     // too early.
     static const double minimumTimePlayingBeforeCacheSnapshot = 0.5;
 
-    m_minimumWallClockTimeToCacheMediaTime = WTF::currentTime() + minimumTimePlayingBeforeCacheSnapshot;
+    m_minimumClockTimeToUpdateCachedTime = monotonicallyIncreasingTime() + minimumTimePlayingBeforeCacheSnapshot;
     m_cachedTime = MediaPlayer::invalidTime();
 }
 
@@ -2301,15 +2301,15 @@ double HTMLMediaElement::currentTime() const
     }
 
     // Is it too soon use a cached time?
-    double now = WTF::currentTime();
+    double now = monotonicallyIncreasingTime();
     double maximumDurationToCacheMediaTime = m_player->maximumDurationToCacheMediaTime();
 
-    if (maximumDurationToCacheMediaTime && m_cachedTime != MediaPlayer::invalidTime() && !m_paused && now > m_minimumWallClockTimeToCacheMediaTime) {
-        double wallClockDelta = now - m_cachedTimeWallClockUpdateTime;
+    if (maximumDurationToCacheMediaTime && m_cachedTime != MediaPlayer::invalidTime() && !m_paused && now > m_minimumClockTimeToUpdateCachedTime) {
+        double clockDelta = now - m_clockTimeAtLastCachedTimeUpdate;
 
         // Not too soon, use the cached time only if it hasn't expired.
-        if (wallClockDelta < maximumDurationToCacheMediaTime) {
-            double adjustedCacheTime = m_cachedTime + (m_playbackRate * wallClockDelta);
+        if (clockDelta < maximumDurationToCacheMediaTime) {
+            double adjustedCacheTime = m_cachedTime + (m_playbackRate * clockDelta);
 
 #if LOG_CACHED_TIME_WARNINGS
             double delta = adjustedCacheTime - m_player->currentTime();
@@ -2321,9 +2321,9 @@ double HTMLMediaElement::currentTime() const
     }
 
 #if LOG_CACHED_TIME_WARNINGS
-    if (maximumDurationToCacheMediaTime && now > m_minimumWallClockTimeToCacheMediaTime && m_cachedTime != MediaPlayer::invalidTime()) {
-        double wallClockDelta = now - m_cachedTimeWallClockUpdateTime;
-        double delta = m_cachedTime + (m_playbackRate * wallClockDelta) - m_player->currentTime();
+    if (maximumDurationToCacheMediaTime && now > m_minimumClockTimeToUpdateCachedTime && m_cachedTime != MediaPlayer::invalidTime()) {
+        double clockDelta = now - m_clockTimeAtLastCachedTimeUpdate;
+        double delta = m_cachedTime + (m_playbackRate * clockDelta) - m_player->currentTime();
         LOG(Media, "HTMLMediaElement::currentTime - cached time was %f seconds off of media time when it expired", delta);
     }
 #endif
@@ -2795,7 +2795,7 @@ void HTMLMediaElement::startPlaybackProgressTimer()
     if (m_playbackProgressTimer.isActive())
         return;
 
-    m_previousProgressTime = WTF::currentTime();
+    m_previousProgressTime = monotonicallyIncreasingTime();
     m_playbackProgressTimer.startRepeating(maxTimeupdateEventFrequency);
 }
 
@@ -2827,8 +2827,8 @@ void HTMLMediaElement::playbackProgressTimerFired(Timer<HTMLMediaElement>*)
 
 void HTMLMediaElement::scheduleTimeupdateEvent(bool periodicEvent)
 {
-    double now = WTF::currentTime();
-    double timedelta = now - m_lastTimeUpdateEventWallTime;
+    double now = monotonicallyIncreasingTime();
+    double timedelta = now - m_clockTimeAtLastUpdateEvent;
 
     // throttle the periodic events
     if (periodicEvent && timedelta < maxTimeupdateEventFrequency)
@@ -2839,7 +2839,7 @@ void HTMLMediaElement::scheduleTimeupdateEvent(bool periodicEvent)
     double movieTime = currentTime();
     if (movieTime != m_lastTimeUpdateEventMovieTime) {
         scheduleEvent(eventNames().timeupdateEvent);
-        m_lastTimeUpdateEventWallTime = now;
+        m_clockTimeAtLastUpdateEvent = now;
         m_lastTimeUpdateEventMovieTime = movieTime;
     }
 }
index c63069a..299380f 100644 (file)
@@ -641,8 +641,8 @@ private:
     unsigned m_previousProgress;
     double m_previousProgressTime;
 
-    // The last time a timeupdate event was sent (wall clock).
-    double m_lastTimeUpdateEventWallTime;
+    // The last time a timeupdate event was sent (based on monotonic clock).
+    double m_clockTimeAtLastUpdateEvent;
 
     // The last time a timeupdate event was sent in movie time.
     double m_lastTimeUpdateEventMovieTime;
@@ -673,8 +673,8 @@ private:
 #endif
 
     mutable double m_cachedTime;
-    mutable double m_cachedTimeWallClockUpdateTime;
-    mutable double m_minimumWallClockTimeToCacheMediaTime;
+    mutable double m_clockTimeAtLastCachedTimeUpdate;
+    mutable double m_minimumClockTimeToUpdateCachedTime;
 
     double m_fragmentStartTime;
     double m_fragmentEndTime;
index 2a3d879..57afc63 100644 (file)
@@ -547,7 +547,7 @@ static bool documentHadRecentUserGesture(Document* document)
     if (document->frame() != document->page()->mainFrame() && document->page()->mainFrame() && document->page()->mainFrame()->document())
         lastKnownUserGestureTimestamp = std::max(lastKnownUserGestureTimestamp, document->page()->mainFrame()->document()->lastHandledUserGestureTimestamp());
 
-    if (currentTime() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGestureThreshold)
+    if (monotonicallyIncreasingTime() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGestureThreshold)
         return true;
 
     return false;
index cbfa21d..b8a585d 100644 (file)
@@ -673,7 +673,7 @@ void MediaController::timeupdateTimerFired(Timer<MediaController>*)
 
 void MediaController::scheduleTimeupdateEvent()
 {
-    double now = WTF::currentTime();
+    double now = monotonicallyIncreasingTime();
     double timedelta = now - m_previousTimeupdateTime;
 
     if (timedelta < maxTimeupdateEventFrequency)
index ace72d8..58866e3 100644 (file)
@@ -468,7 +468,7 @@ void HTMLDocumentParser::pumpPendingSpeculations()
     // FIXME: Pass in current input length.
     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteHTML(document(), lineNumber().zeroBasedInt());
 
-    double startTime = currentTime();
+    double startTime = monotonicallyIncreasingTime();
 
     while (!m_speculations.isEmpty()) {
         processParsedChunkFromBackgroundParser(m_speculations.takeFirst());
@@ -476,7 +476,7 @@ void HTMLDocumentParser::pumpPendingSpeculations()
         if (isWaitingForScripts() || isStopped())
             break;
 
-        if (currentTime() - startTime > parserTimeLimit && !m_speculations.isEmpty()) {
+        if (monotonicallyIncreasingTime() - startTime > parserTimeLimit && !m_speculations.isEmpty()) {
             m_parserScheduler->scheduleForResume();
             break;
         }
index 8256cf4..2ca7222 100644 (file)
@@ -73,12 +73,12 @@ public:
             // currentTime() can be expensive.  By delaying, we avoided calling
             // currentTime() when constructing non-yielding PumpSessions.
             if (!session.startTime)
-                session.startTime = currentTime();
+                session.startTime = monotonicallyIncreasingTime();
 
             session.processedTokens = 0;
             session.didSeeScript = false;
 
-            double elapsedTime = currentTime() - session.startTime;
+            double elapsedTime = monotonicallyIncreasingTime() - session.startTime;
             if (elapsedTime > m_parserTimeLimit)
                 session.needsYield = true;
         }
index f0e6db7..625fdaf 100644 (file)
@@ -109,14 +109,14 @@ class SelectorProfile {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     SelectorProfile()
-        : m_totalMatchingTimeMs(0.0)
+        : m_totalMatchingTimeMS(0.0)
     {
     }
     virtual ~SelectorProfile()
     {
     }
 
-    double totalMatchingTimeMs() const { return m_totalMatchingTimeMs; }
+    double totalMatchingTimeMs() const { return m_totalMatchingTimeMS; }
 
     String makeKey();
     void startSelector(const CSSStyleRule*);
@@ -129,7 +129,7 @@ private:
     // Key is "selector?url:line".
     typedef HashMap<String, RuleMatchingStats> RuleMatchingStatsMap;
 
-    double m_totalMatchingTimeMs;
+    double m_totalMatchingTimeMS;
     RuleMatchingStatsMap m_ruleMatchingStats;
     RuleMatchData m_currentMatchData;
 };
@@ -181,17 +181,17 @@ inline void SelectorProfile::startSelector(const CSSStyleRule* rule)
     }
     m_currentMatchData.url = url;
     m_currentMatchData.lineNumber = rule->styleRule()->sourceLine();
-    m_currentMatchData.startTime = WTF::currentTimeMS();
+    m_currentMatchData.startTime = monotonicallyIncreasingTimeMS();
 }
 
 inline void SelectorProfile::commitSelector(bool matched)
 {
-    double matchTimeMs = WTF::currentTimeMS() - m_currentMatchData.startTime;
-    m_totalMatchingTimeMs += matchTimeMs;
+    double matchTimeMS = monotonicallyIncreasingTimeMS() - m_currentMatchData.startTime;
+    m_totalMatchingTimeMS += matchTimeMS;
 
-    RuleMatchingStatsMap::AddResult result = m_ruleMatchingStats.add(makeKey(), RuleMatchingStats(m_currentMatchData, matchTimeMs, 1, matched ? 1 : 0));
+    RuleMatchingStatsMap::AddResult result = m_ruleMatchingStats.add(makeKey(), RuleMatchingStats(m_currentMatchData, matchTimeMS, 1, matched ? 1 : 0));
     if (!result.isNewEntry) {
-        result.iterator->value.totalTime += matchTimeMs;
+        result.iterator->value.totalTime += matchTimeMS;
         result.iterator->value.hits += 1;
         if (matched)
             result.iterator->value.matches += 1;
@@ -200,14 +200,14 @@ inline void SelectorProfile::commitSelector(bool matched)
 
 inline void SelectorProfile::commitSelectorTime()
 {
-    double processingTimeMs = WTF::currentTimeMS() - m_currentMatchData.startTime;
-    m_totalMatchingTimeMs += processingTimeMs;
+    double processingTimeMS = monotonicallyIncreasingTimeMS() - m_currentMatchData.startTime;
+    m_totalMatchingTimeMS += processingTimeMS;
 
     RuleMatchingStatsMap::iterator it = m_ruleMatchingStats.find(makeKey());
     if (it == m_ruleMatchingStats.end())
         return;
 
-    it->value.totalTime += processingTimeMs;
+    it->value.totalTime += processingTimeMS;
 }
 
 PassRefPtr<TypeBuilder::CSS::SelectorProfile> SelectorProfile::toInspectorObject() const
index ad4cebd..322eb99 100644 (file)
@@ -491,7 +491,7 @@ void InspectorProfilerAgent::willProcessTask()
     if (!m_previousTaskEndTime)
         return;
 
-    double idleTime = WTF::monotonicallyIncreasingTime() - m_previousTaskEndTime;
+    double idleTime = monotonicallyIncreasingTime() - m_previousTaskEndTime;
     m_previousTaskEndTime = 0.0;
     ProfileNameIdleTimeMap::iterator end = m_profileNameIdleTimeMap->end();
     for (ProfileNameIdleTimeMap::iterator it = m_profileNameIdleTimeMap->begin(); it != end; ++it)
@@ -502,7 +502,7 @@ void InspectorProfilerAgent::didProcessTask()
 {
     if (!m_profileNameIdleTimeMap || !m_profileNameIdleTimeMap->size())
         return;
-    m_previousTaskEndTime = WTF::monotonicallyIncreasingTime();
+    m_previousTaskEndTime = monotonicallyIncreasingTime();
 }
 
 } // namespace WebCore
index 2426355..a0188f4 100644 (file)
@@ -718,7 +718,7 @@ void InspectorTimelineAgent::localToPageQuad(const RenderObject& renderer, const
 
 double InspectorTimelineAgent::timestamp()
 {
-    return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyIncreasingTime());
+    return m_timeConverter.fromMonotonicallyIncreasingTime(monotonicallyIncreasingTime());
 }
 
 Page* InspectorTimelineAgent::page()
index 05f7c09..5d11508 100644 (file)
@@ -213,7 +213,7 @@ void TimelineTraceEventProcessor::processEventOnAnyThread(TraceEventPhase phase,
     if (it == m_handlersByType.end())
         return;
 
-    TraceEvent event(WTF::monotonicallyIncreasingTime(), phase, name, id, currentThread(), numArgs, argNames, argTypes, argValues);
+    TraceEvent event(monotonicallyIncreasingTime(), phase, name, id, currentThread(), numArgs, argNames, argTypes, argValues);
 
     if (!isMainThread()) {
         MutexLocker locker(m_backgroundEventsMutex);
index 1e6e4b9..c7003ba 100644 (file)
@@ -2330,7 +2330,7 @@ double FrameView::adjustedDeferredRepaintDelay() const
     ASSERT(!m_deferringRepaints);
     if (!m_deferredRepaintDelay)
         return 0;
-    double timeSinceLastPaint = currentTime() - m_lastPaintTime;
+    double timeSinceLastPaint = monotonicallyIncreasingTime() - m_lastPaintTime;
     return max(0., m_deferredRepaintDelay - timeSinceLastPaint);
 }
     
@@ -3532,7 +3532,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
 
     bool isTopLevelPainter = !sCurrentPaintTimeStamp;
     if (isTopLevelPainter)
-        sCurrentPaintTimeStamp = currentTime();
+        sCurrentPaintTimeStamp = monotonicallyIncreasingTime();
 
     FontCachePurgePreventer fontCachePurgePreventer;
 
@@ -3581,7 +3581,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
         notifyWidgetsInAllFrames(DidPaintFlattened);
 
     m_paintBehavior = oldPaintBehavior;
-    m_lastPaintTime = currentTime();
+    m_lastPaintTime = monotonicallyIncreasingTime();
 
     // Regions may have changed as a result of the visibility/z-index of element changing.
 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION)
index 99aa340..fac2267 100644 (file)
@@ -79,5 +79,5 @@ void ClockGeneric::stop()
 
 double ClockGeneric::now() const
 {
-    return WTF::currentTime();
+    return monotonicallyIncreasingTime();
 }
index 5607524..dc3381b 100644 (file)
@@ -454,7 +454,7 @@ bool ScrollAnimatorNone::scroll(ScrollbarOrientation orientation, ScrollGranular
     float scrollableSize = static_cast<float>(m_scrollableArea->scrollSize(orientation));
 
     PerAxisData& data = (orientation == VerticalScrollbar) ? m_verticalData : m_horizontalData;
-    bool needToScroll = data.updateDataFromParameters(step, multiplier, scrollableSize, WTF::monotonicallyIncreasingTime(), &parameters);
+    bool needToScroll = data.updateDataFromParameters(step, multiplier, scrollableSize, monotonicallyIncreasingTime(), &parameters);
     if (needToScroll && !animationTimerActive()) {
         m_startTime = data.m_startTime;
         animationWillStart();
@@ -523,7 +523,7 @@ void ScrollAnimatorNone::animationTimerFired(Timer<ScrollAnimatorNone>* timer)
 
 void ScrollAnimatorNone::animationTimerFired()
 {
-    double currentTime = WTF::monotonicallyIncreasingTime();
+    double currentTime = monotonicallyIncreasingTime();
     double deltaToNextFrame = ceil((currentTime - m_startTime) * kFrameRate) / kFrameRate - (currentTime - m_startTime);
     currentTime += deltaToNextFrame;
 
index 5072739..49d9eb4 100644 (file)
@@ -182,7 +182,7 @@ ImageBuffer::ImageBuffer(const IntSize& size, float resolutionScale, ColorSpace
     m_context->translate(0, -size.height());
     m_context->setIsAcceleratedContext(accelerateRendering);
 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
-    m_data.m_lastFlushTime = currentTimeMS();
+    m_data.m_lastFlushTime = monotonicallyIncreasingTimeMS();
 #endif
     success = true;
 }
@@ -204,7 +204,7 @@ void ImageBuffer::flushContextIfNecessary() const
 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
     // Force a flush if last flush was more than 20ms ago
     if (m_context->isAcceleratedContext()) {
-        double elapsedTime = currentTimeMS() - m_data.m_lastFlushTime;
+        double elapsedTime = monotonicallyIncreasingTimeMS() - m_data.m_lastFlushTime;
         double maxFlushInterval = 20; // in ms
 
         if (elapsedTime > maxFlushInterval)
@@ -217,7 +217,7 @@ void ImageBuffer::flushContext() const
 {
     CGContextFlush(m_context->platformContext());
 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
-    m_data.m_lastFlushTime = currentTimeMS();
+    m_data.m_lastFlushTime = monotonicallyIncreasingTimeMS();
 #endif
 }
 
@@ -265,7 +265,7 @@ PassNativeImagePtr ImageBuffer::copyNativeImage(BackingStoreCopy copyBehavior) c
     else {
         image = wkIOSurfaceContextCreateImage(context()->platformContext());
 #if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
-        m_data.m_lastFlushTime = currentTimeMS();
+        m_data.m_lastFlushTime = monotonicallyIncreasingTimeMS();
 #endif
     }
 #endif