Replace currentTime() with monotonicallyIncreasingTime() in WebCore
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Aug 2013 20:47:27 +0000 (20:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Aug 2013 20:47:27 +0000 (20:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=119958

Patch by Arunprasad Rajkumar <arurajku@cisco.com> on 2013-08-27
Reviewed by Alexey Proskuryakov.

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

It is a continuation of r154201.

Source/WebCore:

* history/CachedPage.cpp:
(WebCore::CachedPage::CachedPage):
(WebCore::CachedPage::hasExpired):
* html/parser/HTMLParserScheduler.h:
(WebCore::HTMLParserScheduler::checkForYieldBeforeToken):
* loader/CrossOriginPreflightResultCache.cpp:
(WebCore::CrossOriginPreflightResultCacheItem::parse):
(WebCore::CrossOriginPreflightResultCacheItem::allowsRequest):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::setState):
* loader/ProgressTracker.cpp:
(WebCore::ProgressTracker::incrementProgress):
* loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::didDraw):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::pruneLiveResourcesToSize):
* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::iconDatabaseSyncThread):
(WebCore::IconDatabase::syncThreadMainLoop):
(WebCore::IconDatabase::readFromDatabase):
(WebCore::IconDatabase::writeToDatabase):
(WebCore::IconDatabase::cleanupSyncThread):
* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::freezeAtTime):
* page/animation/AnimationController.cpp:
(WebCore::AnimationControllerPrivate::beginAnimationUpdateTime):
* platform/graphics/GraphicsLayerAnimation.cpp:
(WebCore::GraphicsLayerAnimation::computeTotalRunningTime):
(WebCore::GraphicsLayerAnimation::resume):
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::AVFWrapper::createImageForTimeInRect):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createPixelBuffer):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::suspendAnimations):
* platform/graphics/ca/PlatformCALayer.h:
(WebCore::PlatformCALayer::currentTimeToMediaTime):
* platform/graphics/ca/mac/LayerPool.mm:
(WebCore::LayerPool::addLayer):
(WebCore::LayerPool::decayedCapacity):
(WebCore::LayerPool::pruneTimerFired):
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(mediaTimeToCurrentTime):
* platform/graphics/ca/win/CACFLayerTreeHost.cpp:
(WebCore::CACFLayerTreeHost::notifyAnimationsStarted):
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayer::printTree):
* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::addAnimation):
* platform/graphics/texmap/TextureMapperFPSCounter.cpp:
(WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
(WebCore::TextureMapperFPSCounter::updateFPSAndDisplay):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::addAnimation):
* platform/network/DNSResolveQueue.cpp:
(WebCore::DNSResolveQueue::isUsingProxy):
* plugins/win/PluginMessageThrottlerWin.cpp:
(WebCore::PluginMessageThrottlerWin::appendMessage):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::didPaintBacking):
(WebCore::RenderLayerCompositor::updateCompositingLayers):
* rendering/RenderProgress.cpp:
(WebCore::RenderProgress::animationProgress):
(WebCore::RenderProgress::updateAnimationState):
* svg/animation/SMILTimeContainer.cpp:
(WebCore::SMILTimeContainer::elapsed):
(WebCore::SMILTimeContainer::begin):
(WebCore::SMILTimeContainer::pause):
(WebCore::SMILTimeContainer::resume):
(WebCore::SMILTimeContainer::setElapsed):

Source/WTF:

* wtf/CurrentTime.h: Edited comment.

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

31 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/CurrentTime.h
Source/WebCore/ChangeLog
Source/WebCore/history/CachedPage.cpp
Source/WebCore/html/parser/HTMLParserScheduler.h
Source/WebCore/loader/CrossOriginPreflightResultCache.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/ProgressTracker.cpp
Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
Source/WebCore/loader/cache/CachedImage.cpp
Source/WebCore/loader/cache/MemoryCache.cpp
Source/WebCore/loader/icon/IconDatabase.cpp
Source/WebCore/page/animation/AnimationBase.cpp
Source/WebCore/page/animation/AnimationController.cpp
Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/PlatformCALayer.h
Source/WebCore/platform/graphics/ca/mac/LayerPool.mm
Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
Source/WebCore/platform/network/DNSResolveQueue.cpp
Source/WebCore/plugins/win/PluginMessageThrottlerWin.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderProgress.cpp
Source/WebCore/svg/animation/SMILTimeContainer.cpp

index e2b74bd9326f544ed54a734b2d2fea3607384a5c..00bedd980c2fc8a5c9448aeebdd6c56636099b6b 100644 (file)
@@ -1,3 +1,17 @@
+2013-08-27  Arunprasad Rajkumar  <arurajku@cisco.com>
+
+        Replace currentTime() with monotonicallyIncreasingTime() in WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=119958
+
+        Reviewed by Alexey Proskuryakov.
+
+        WTF::currentTime() is prone to NTP and manual adjustments, so use
+        WTF::monotonicallyIncreasingTime() to measure elapsed time.
+
+        It is a continuation of r154201.
+
+        * wtf/CurrentTime.h: Edited comment.
+
 2013-08-27  Andre Moreira Magalhaes   <andre.magalhaes@collabora.co.uk>
 
         [gstreamer] Make sure gstreamer source element is thread-safe
index 24b2a30b4d9d933d16d473fcdf86120a83bfdc5a..bf9fb33affb93ce37dcd5b5b7e5ee5b3a3e33007 100644 (file)
@@ -52,7 +52,7 @@ 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.
+// NTP or manual adjustments, so it is better suited for elapsed time measurement.
 WTF_EXPORT_PRIVATE double monotonicallyIncreasingTime();
 
 inline double monotonicallyIncreasingTimeMS()
index 1c673b06fff1019e97022e98477f4efb74ab150f..393be5eaa35846a77d37fa3f43af70bda5e4e87e 100644 (file)
@@ -1,3 +1,89 @@
+2013-08-27  Arunprasad Rajkumar  <arurajku@cisco.com>
+
+        Replace currentTime() with monotonicallyIncreasingTime() in WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=119958
+
+        Reviewed by Alexey Proskuryakov.
+
+        WTF::currentTime() is prone to NTP and manual adjustments, so use
+        WTF::monotonicallyIncreasingTime() to measure elapsed time.
+
+        It is a continuation of r154201.
+
+        * history/CachedPage.cpp:
+        (WebCore::CachedPage::CachedPage):
+        (WebCore::CachedPage::hasExpired):
+        * html/parser/HTMLParserScheduler.h:
+        (WebCore::HTMLParserScheduler::checkForYieldBeforeToken):
+        * loader/CrossOriginPreflightResultCache.cpp:
+        (WebCore::CrossOriginPreflightResultCacheItem::parse):
+        (WebCore::CrossOriginPreflightResultCacheItem::allowsRequest):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::setState):
+        * loader/ProgressTracker.cpp:
+        (WebCore::ProgressTracker::incrementProgress):
+        * loader/cache/CachedCSSStyleSheet.cpp:
+        (WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet):
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::didDraw):
+        * loader/cache/MemoryCache.cpp:
+        (WebCore::MemoryCache::pruneLiveResourcesToSize):
+        * loader/icon/IconDatabase.cpp:
+        (WebCore::IconDatabase::iconDatabaseSyncThread):
+        (WebCore::IconDatabase::syncThreadMainLoop):
+        (WebCore::IconDatabase::readFromDatabase):
+        (WebCore::IconDatabase::writeToDatabase):
+        (WebCore::IconDatabase::cleanupSyncThread):
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::freezeAtTime):
+        * page/animation/AnimationController.cpp:
+        (WebCore::AnimationControllerPrivate::beginAnimationUpdateTime):
+        * platform/graphics/GraphicsLayerAnimation.cpp:
+        (WebCore::GraphicsLayerAnimation::computeTotalRunningTime):
+        (WebCore::GraphicsLayerAnimation::resume):
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        (WebCore::AVFWrapper::createImageForTimeInRect):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createPixelBuffer):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::suspendAnimations):
+        * platform/graphics/ca/PlatformCALayer.h:
+        (WebCore::PlatformCALayer::currentTimeToMediaTime):
+        * platform/graphics/ca/mac/LayerPool.mm:
+        (WebCore::LayerPool::addLayer):
+        (WebCore::LayerPool::decayedCapacity):
+        (WebCore::LayerPool::pruneTimerFired):
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (mediaTimeToCurrentTime):
+        * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
+        (WebCore::CACFLayerTreeHost::notifyAnimationsStarted):
+        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+        (PlatformCALayer::printTree):
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+        (WebCore::GraphicsLayerTextureMapper::addAnimation):
+        * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
+        (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
+        (WebCore::TextureMapperFPSCounter::updateFPSAndDisplay):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::addAnimation):
+        * platform/network/DNSResolveQueue.cpp:
+        (WebCore::DNSResolveQueue::isUsingProxy):
+        * plugins/win/PluginMessageThrottlerWin.cpp:
+        (WebCore::PluginMessageThrottlerWin::appendMessage):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::didPaintBacking):
+        (WebCore::RenderLayerCompositor::updateCompositingLayers):
+        * rendering/RenderProgress.cpp:
+        (WebCore::RenderProgress::animationProgress):
+        (WebCore::RenderProgress::updateAnimationState):
+        * svg/animation/SMILTimeContainer.cpp:
+        (WebCore::SMILTimeContainer::elapsed):
+        (WebCore::SMILTimeContainer::begin):
+        (WebCore::SMILTimeContainer::pause):
+        (WebCore::SMILTimeContainer::resume):
+        (WebCore::SMILTimeContainer::setElapsed):
+
 2013-08-27  Robert Hogan  <robert@webkit.org>
 
         cell width / offsetTop incorrect
index 5400af4b2c547c329e401050c405e2414b193028..b6d46687d5a1888c5c812f4f4b7ec626c07fed60 100644 (file)
@@ -51,7 +51,7 @@ PassRefPtr<CachedPage> CachedPage::create(Page* page)
 }
 
 CachedPage::CachedPage(Page* page)
-    : m_timeStamp(currentTime())
+    : m_timeStamp(monotonicallyIncreasingTime())
     , m_expirationTime(m_timeStamp + page->settings().backForwardCacheExpirationInterval())
     , m_cachedMainFrame(CachedFrame::create(&page->mainFrame()))
     , m_needStyleRecalcForVisitedLinks(false)
@@ -129,7 +129,7 @@ void CachedPage::destroy()
 
 bool CachedPage::hasExpired() const
 {
-    return currentTime() > m_expirationTime;
+    return monotonicallyIncreasingTime() > m_expirationTime;
 }
 
 } // namespace WebCore
index 2ca72224004237a5221fe0093f1961ce2d562e97..c215cb08ea5dbed0a0b6c1de27a823ea67985943 100644 (file)
@@ -70,8 +70,8 @@ public:
     void checkForYieldBeforeToken(PumpSession& session)
     {
         if (session.processedTokens > m_parserChunkSize || session.didSeeScript) {
-            // currentTime() can be expensive.  By delaying, we avoided calling
-            // currentTime() when constructing non-yielding PumpSessions.
+            // monotonicallyIncreasingTime() can be expensive. By delaying, we avoided calling
+            // monotonicallyIncreasingTime() when constructing non-yielding PumpSessions.
             if (!session.startTime)
                 session.startTime = monotonicallyIncreasingTime();
 
index 9d51c87fe6c4e7d43933e45eef7d5c19bd5e2084..4a17dfddfd1a597345ce24d1fd00f9abb29a1a2d 100644 (file)
@@ -108,7 +108,7 @@ bool CrossOriginPreflightResultCacheItem::parse(const ResourceResponse& response
     } else
         expiryDelta = defaultPreflightCacheTimeoutSeconds;
 
-    m_absoluteExpiryTime = currentTime() + expiryDelta;
+    m_absoluteExpiryTime = monotonicallyIncreasingTime() + expiryDelta;
     return true;
 }
 
@@ -136,7 +136,7 @@ bool CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders(const HTTPHea
 bool CrossOriginPreflightResultCacheItem::allowsRequest(StoredCredentials includeCredentials, const String& method, const HTTPHeaderMap& requestHeaders) const
 {
     String ignoredExplanation;
-    if (m_absoluteExpiryTime < currentTime())
+    if (m_absoluteExpiryTime < monotonicallyIncreasingTime())
         return false;
     if (includeCredentials == AllowStoredCredentials && m_credentials == DoNotAllowStoredCredentials)
         return false;
index 68e64b666b6eebdf6a528eef2daef985ed4860dc..c08dd81f67d7543dabccd2c3871dc14be521ca43 100644 (file)
@@ -1683,7 +1683,7 @@ void FrameLoader::setState(FrameState newState)
         provisionalLoadStarted();
     else if (newState == FrameStateComplete) {
         frameLoadCompleted();
-        storedTimeOfLastCompletedLoad = currentTime();
+        storedTimeOfLastCompletedLoad = monotonicallyIncreasingTime();
         if (m_documentLoader)
             m_documentLoader->stopRecordingResponses();
     }
index 0b99a43c06e449d7a83a585c1dd209e331c30ef8..818092eabe52eaedf81b85c13f10453f9497996e 100644 (file)
@@ -241,7 +241,7 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i
     
     m_totalBytesReceived += bytesReceived;
     
-    double now = currentTime();
+    double now = monotonicallyIncreasingTime();
     double notifiedProgressTimeDelta = now - m_lastNotifiedProgressTime;
     
     LOG(Progress, "Progress incremented (%p) - value %f, tracked frames %d", this, m_progressValue, m_numProgressTrackedFrames);
index 436777e6994e52247ae6fdf02fccb51105abf332..693ab00858f9880b817100be6f1d7a5995a9d71f 100644 (file)
@@ -173,7 +173,7 @@ PassRefPtr<StyleSheetContents> CachedCSSStyleSheet::restoreParsedStyleSheet(cons
     if (m_parsedStyleSheetCache->parserContext() != context)
         return 0;
 
-    didAccessDecodedData(currentTime());
+    didAccessDecodedData(monotonicallyIncreasingTime());
 
     return m_parsedStyleSheetCache;
 }
index 948e6047ed1754f2e8a545868809bb4e5eef4622..69e4262099ea8b8619016da6a15eea5901cdd33e 100644 (file)
@@ -468,7 +468,7 @@ void CachedImage::didDraw(const Image* image)
     
     double timeStamp = FrameView::currentPaintTimeStamp();
     if (!timeStamp) // If didDraw is called outside of a Frame paint.
-        timeStamp = currentTime();
+        timeStamp = monotonicallyIncreasingTime();
     
     CachedResource::didAccessDecodedData(timeStamp);
 }
index 292fa2f949b0b1c53ca7569b7bacb320cae0868e..b6723386a218b1938c7965370bfed45138a77388 100644 (file)
@@ -243,7 +243,7 @@ void MemoryCache::pruneLiveResourcesToSize(unsigned targetSize)
 
     double currentTime = FrameView::currentPaintTimeStamp();
     if (!currentTime) // In case prune is called directly, outside of a Frame paint.
-        currentTime = WTF::currentTime();
+        currentTime = monotonicallyIncreasingTime();
     
     // Destroy any decoded data in live objects that we can.
     // Start from the tail, since this is the least recently accessed of the objects.
index 0aca0451def77817f8b7052cd40b7db363d46e03..e05ebdeb48c5e83fc8fafb3fd16ea0528f2196b7 100644 (file)
@@ -989,7 +989,7 @@ void IconDatabase::iconDatabaseSyncThread()
     LOG(IconDatabase, "(THREAD) IconDatabase sync thread started");
 
 #if !LOG_DISABLED
-    double startTime = currentTime();
+    double startTime = monotonicallyIncreasingTime();
 #endif
 
     // Need to create the database path if it doesn't already exist
@@ -1017,7 +1017,7 @@ void IconDatabase::iconDatabaseSyncThread()
     }
         
 #if !LOG_DISABLED
-    double timeStamp = currentTime();
+    double timeStamp = monotonicallyIncreasingTime();
     LOG(IconDatabase, "(THREAD) Open took %.4f seconds", timeStamp - startTime);
 #endif    
 
@@ -1028,13 +1028,13 @@ void IconDatabase::iconDatabaseSyncThread()
     }
         
 #if !LOG_DISABLED
-    double newStamp = currentTime();
+    double newStamp = monotonicallyIncreasingTime();
     LOG(IconDatabase, "(THREAD) performOpenInitialization() took %.4f seconds, now %.4f seconds from thread start", newStamp - timeStamp, newStamp - startTime);
     timeStamp = newStamp;
 #endif 
         
     // Uncomment the following line to simulate a long lasting URL import (*HUGE* icon databases, or network home directories)
-    // while (currentTime() - timeStamp < 10);
+    // while (monotonicallyIncreasingTime() - timeStamp < 10);
 
     // Read in URL mappings from the database          
     LOG(IconDatabase, "(THREAD) Starting iconURL import");
@@ -1046,7 +1046,7 @@ void IconDatabase::iconDatabaseSyncThread()
     }
 
 #if !LOG_DISABLED
-    newStamp = currentTime();
+    newStamp = monotonicallyIncreasingTime();
     LOG(IconDatabase, "(THREAD) performURLImport() took %.4f seconds.  Entering main loop %.4f seconds from thread start", newStamp - timeStamp, newStamp - startTime);
 #endif 
 
@@ -1374,7 +1374,7 @@ void IconDatabase::syncThreadMainLoop()
         m_syncLock.unlock();
 
 #if !LOG_DISABLED
-        double timeStamp = currentTime();
+        double timeStamp = monotonicallyIncreasingTime();
 #endif
         LOG(IconDatabase, "(THREAD) Main work loop starting");
 
@@ -1412,13 +1412,13 @@ void IconDatabase::syncThreadMainLoop()
             static bool prunedUnretainedIcons = false;
             if (didWrite && !m_privateBrowsingEnabled && !prunedUnretainedIcons && !databaseCleanupCounter) {
 #if !LOG_DISABLED
-                double time = currentTime();
+                double time = monotonicallyIncreasingTime();
 #endif
                 LOG(IconDatabase, "(THREAD) Starting pruneUnretainedIcons()");
                 
                 pruneUnretainedIcons();
                 
-                LOG(IconDatabase, "(THREAD) pruneUnretainedIcons() took %.4f seconds", currentTime() - time);
+                LOG(IconDatabase, "(THREAD) pruneUnretainedIcons() took %.4f seconds", monotonicallyIncreasingTime() - time);
                 
                 // If pruneUnretainedIcons() returned early due to requested thread termination, its still okay
                 // to mark prunedUnretainedIcons true because we're about to terminate anyway
@@ -1431,7 +1431,7 @@ void IconDatabase::syncThreadMainLoop()
         }
         
 #if !LOG_DISABLED
-        double newstamp = currentTime();
+        double newstamp = monotonicallyIncreasingTime();
         LOG(IconDatabase, "(THREAD) Main work loop ran for %.4f seconds, %s requested to terminate", newstamp - timeStamp, shouldStopThreadActivity() ? "was" : "was not");
 #endif
                     
@@ -1513,7 +1513,7 @@ bool IconDatabase::readFromDatabase()
     ASSERT_ICON_SYNC_THREAD();
     
 #if !LOG_DISABLED
-    double timeStamp = currentTime();
+    double timeStamp = monotonicallyIncreasingTime();
 #endif
 
     bool didAnyWork = false;
@@ -1607,7 +1607,7 @@ bool IconDatabase::readFromDatabase()
             return didAnyWork;
     }
 
-    LOG(IconDatabase, "Reading from database took %.4f seconds", currentTime() - timeStamp);
+    LOG(IconDatabase, "Reading from database took %.4f seconds", monotonicallyIncreasingTime() - timeStamp);
 
     return didAnyWork;
 }
@@ -1617,7 +1617,7 @@ bool IconDatabase::writeToDatabase()
     ASSERT_ICON_SYNC_THREAD();
 
 #if !LOG_DISABLED
-    double timeStamp = currentTime();
+    double timeStamp = monotonicallyIncreasingTime();
 #endif
 
     bool didAnyWork = false;
@@ -1667,7 +1667,7 @@ bool IconDatabase::writeToDatabase()
     if (didAnyWork)
         checkForDanglingPageURLs(false);
 
-    LOG(IconDatabase, "Updating the database took %.4f seconds", currentTime() - timeStamp);
+    LOG(IconDatabase, "Updating the database took %.4f seconds", monotonicallyIncreasingTime() - timeStamp);
 
     return didAnyWork;
 }
@@ -1822,7 +1822,7 @@ void* IconDatabase::cleanupSyncThread()
     ASSERT_ICON_SYNC_THREAD();
     
 #if !LOG_DISABLED
-    double timeStamp = currentTime();
+    double timeStamp = monotonicallyIncreasingTime();
 #endif 
 
     // If the removeIcons flag is set, remove all icons from the db.
@@ -1842,7 +1842,7 @@ void* IconDatabase::cleanupSyncThread()
     m_syncDB.close();
     
 #if !LOG_DISABLED
-    LOG(IconDatabase, "(THREAD) Final closure took %.4f seconds", currentTime() - timeStamp);
+    LOG(IconDatabase, "(THREAD) Final closure took %.4f seconds", monotonicallyIncreasingTime() - timeStamp);
 #endif
     
     m_syncThreadRunning = false;
index 8da678b492a6004af419b7ce49aa13394c9c1e74..93184bf322294b74269e988851a924268eb581df 100644 (file)
@@ -650,7 +650,7 @@ void AnimationBase::freezeAtTime(double t)
         // If we haven't started yet, make it as if we started.
         LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
         m_animState = AnimationStateStartWaitResponse;
-        onAnimationStartResponse(currentTime());
+        onAnimationStartResponse(monotonicallyIncreasingTime());
     }
 
     ASSERT(m_startTime);        // if m_startTime is zero, we haven't started yet, so we'll get a bad pause time.
index 1c61ab9b13edbc52e2e0a73b550f2c26c5ae6957..abea5551a0b6772206584f6e32d5ee4b16cf2387 100644 (file)
@@ -365,7 +365,7 @@ bool AnimationControllerPrivate::pauseTransitionAtTime(RenderObject* renderer, c
 double AnimationControllerPrivate::beginAnimationUpdateTime()
 {
     if (m_beginAnimationUpdateTime == cBeginAnimationUpdateTimeNotSet)
-        m_beginAnimationUpdateTime = currentTime();
+        m_beginAnimationUpdateTime = monotonicallyIncreasingTime();
     return m_beginAnimationUpdateTime;
 }
 
index 206d707b3ad1501ae51b31d562480dba62e05fee..093bf168010635b610cd686792c5b7ec77ae9848 100644 (file)
@@ -323,7 +323,7 @@ double GraphicsLayerAnimation::computeTotalRunningTime()
         return m_pauseTime;
 
     double oldLastRefreshedTime = m_lastRefreshedTime;
-    m_lastRefreshedTime = WTF::currentTime();
+    m_lastRefreshedTime = monotonicallyIncreasingTime();
     m_totalRunningTime += m_lastRefreshedTime - oldLastRefreshedTime;
     return m_totalRunningTime;
 }
@@ -338,7 +338,7 @@ void GraphicsLayerAnimation::resume()
 {
     setState(PlayingState);
     m_totalRunningTime = m_pauseTime;
-    m_lastRefreshedTime = WTF::currentTime();
+    m_lastRefreshedTime = monotonicallyIncreasingTime();
 }
 
 void GraphicsLayerAnimations::add(const GraphicsLayerAnimation& animation)
index 15cf4985b85dd533acc545df58f0bd48114fab5c..dc11c1c23f1459bba030e766de62b56d857ff8bf 100644 (file)
@@ -1632,14 +1632,14 @@ RetainPtr<CGImageRef> AVFWrapper::createImageForTimeInRect(float time, const Int
         return 0;
 
 #if !LOG_DISABLED
-    double start = WTF::currentTime();
+    double start = monotonicallyIncreasingTime();
 #endif
 
     AVCFAssetImageGeneratorSetMaximumSize(m_imageGenerator.get(), CGSize(rect.size()));
     CGImageRef image = AVCFAssetImageGeneratorCopyCGImageAtTime(m_imageGenerator.get(), CMTimeMakeWithSeconds(time, 600), 0, 0);
 
 #if !LOG_DISABLED
-    double duration = WTF::currentTime() - start;
+    double duration = monotonicallyIncreasingTime() - start;
     LOG(Media, "AVFWrapper::createImageForTimeInRect(%p) - creating image took %.4f", this, narrowPrecisionToFloat(duration));
 #endif
 
index 3891e0cd303118682abe45ae39230c051cc35129..4a00104193f03eb04b550722708199b5da610b7c 100644 (file)
@@ -850,14 +850,14 @@ RetainPtr<CGImageRef> MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRe
     ASSERT(m_imageGenerator);
 
 #if !LOG_DISABLED
-    double start = WTF::currentTime();
+    double start = monotonicallyIncreasingTime();
 #endif
 
     [m_imageGenerator.get() setMaximumSize:CGSize(rect.size())];
     RetainPtr<CGImageRef> image = adoptCF([m_imageGenerator.get() copyCGImageAtTime:CMTimeMakeWithSeconds(time, 600) actualTime:nil error:nil]);
 
 #if !LOG_DISABLED
-    double duration = WTF::currentTime() - start;
+    double duration = monotonicallyIncreasingTime() - start;
     LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect(%p) - creating image took %.4f", this, narrowPrecisionToFloat(duration));
 #endif
 
@@ -1139,7 +1139,7 @@ RetainPtr<CVPixelBufferRef> MediaPlayerPrivateAVFoundationObjC::createPixelBuffe
     ASSERT(m_videoOutput);
 
 #if !LOG_DISABLED
-    double start = WTF::currentTime();
+    double start = monotonicallyIncreasingTime();
 #endif
 
     CMTime currentTime = [m_avPlayerItem.get() currentTime];
@@ -1166,7 +1166,7 @@ RetainPtr<CVPixelBufferRef> MediaPlayerPrivateAVFoundationObjC::createPixelBuffe
 #endif
 
 #if !LOG_DISABLED
-    double duration = WTF::currentTime() - start;
+    double duration = monotonicallyIncreasingTime() - start;
     LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createPixelBuffer() - creating buffer took %.4f", this, narrowPrecisionToFloat(duration));
 #endif
 
index 0bd2cd3440c66176988fcebf053577fa8e18792b..6f7a9657addaf88fd3db50a36b01d27a30702375 100644 (file)
@@ -2531,7 +2531,7 @@ bool GraphicsLayerCA::setFilterAnimationKeyframes(const KeyframeValueList& value
 
 void GraphicsLayerCA::suspendAnimations(double time)
 {
-    double t = PlatformCALayer::currentTimeToMediaTime(time ? time : currentTime());
+    double t = PlatformCALayer::currentTimeToMediaTime(time ? time : monotonicallyIncreasingTime());
     primaryLayer()->setSpeed(0);
     primaryLayer()->setTimeOffset(t);
 
index 5bd524bfe03e6d4c8d3281a6e95a787b72b0ef51..7492eb0a7dafe208bfe07da4df8e73e997790a2b 100644 (file)
@@ -51,7 +51,7 @@ typedef Vector<RefPtr<PlatformCALayer> > PlatformCALayerList;
 
 class PlatformCALayer : public RefCounted<PlatformCALayer> {
 public:
-    static CFTimeInterval currentTimeToMediaTime(double t) { return CACurrentMediaTime() + t - WTF::currentTime(); }
+    static CFTimeInterval currentTimeToMediaTime(double t) { return CACurrentMediaTime() + t - monotonicallyIncreasingTime(); }
 
     // LayerTypeRootLayer is used on some platforms. It has no backing store, so setNeedsDisplay
     // should not call CACFLayerSetNeedsDisplay, but rather just notify the renderer that it
index 1e1345b759d9bc5810e240ac0e88da2bb0af08e4..6ff1ec84c262fd30ab9975a26c713317c44f42e8 100644 (file)
@@ -75,7 +75,7 @@ void LayerPool::addLayer(const RetainPtr<WebTileLayer>& layer)
     listOfLayersWithSize(layerSize).prepend(layer);
     m_totalBytes += backingStoreBytesForSize(layerSize);
     
-    m_lastAddTime = currentTime();
+    m_lastAddTime = monotonicallyIncreasingTime();
     schedulePrune();
 }
 
@@ -93,7 +93,7 @@ RetainPtr<WebTileLayer> LayerPool::takeLayerWithSize(const IntSize& size)
 unsigned LayerPool::decayedCapacity() const
 {
     // Decay to one quarter over capacityDecayTime
-    double timeSinceLastAdd = currentTime() - m_lastAddTime;
+    double timeSinceLastAdd = monotonicallyIncreasingTime() - m_lastAddTime;
     if (timeSinceLastAdd > capacityDecayTime)
         return m_maxBytesForPool / 4;
     float decayProgess = float(timeSinceLastAdd / capacityDecayTime);
@@ -125,7 +125,7 @@ void LayerPool::pruneTimerFired(Timer<LayerPool>*)
         // still have a backing store.
         oldestReuseList.remove(--oldestReuseList.end());
     }
-    if (currentTime() - m_lastAddTime <= capacityDecayTime)
+    if (monotonicallyIncreasingTime() - m_lastAddTime <= capacityDecayTime)
         schedulePrune();
 }
 
index 3583962266e7688bd00187fd2dfe18689e2b8da7..eea81bfbb9ce97929f07306f880504fed17d8735 100644 (file)
@@ -61,7 +61,7 @@ static NSString * const WKNonZeroBeginTimeFlag = @"WKPlatformCAAnimationNonZeroB
 
 static double mediaTimeToCurrentTime(CFTimeInterval t)
 {
-    return WTF::currentTime() + t - CACurrentMediaTime();
+    return monotonicallyIncreasingTime() + t - CACurrentMediaTime();
 }
 
 // Delegate for animationDidStart callback
index 2e4ec5ed6e59d72035302656c5ef47448267ef4e..67faa0ae855c786a487676a22941b8facb71ad2b 100644 (file)
@@ -309,7 +309,7 @@ void CACFLayerTreeHost::notifyAnimationsStarted()
     // Send currentTime to the pending animations. This function is called by CACF in a callback
     // which occurs after the drawInContext calls. So currentTime is very close to the time
     // the animations actually start
-    double currentTime = WTF::currentTime();
+    double currentTime = monotonicallyIncreasingTime();
 
     HashSet<RefPtr<PlatformCALayer> >::iterator end = m_pendingAnimatedLayers.end();
     for (HashSet<RefPtr<PlatformCALayer> >::iterator it = m_pendingAnimatedLayers.begin(); it != end; ++it)
index f5b7c6fa231eb7d40b08e25ba75fbd0cc6c70907..5f71ddf416f1449b155960e381a156620fe07629 100644 (file)
@@ -771,7 +771,7 @@ void PlatformCALayer::printTree() const
     // Print heading info
     CGRect rootBounds = bounds();
     fprintf(stderr, "\n\n** Render tree at time %g (bounds %g, %g %gx%g) **\n\n", 
-        currentTime(), rootBounds.origin.x, rootBounds.origin.y, rootBounds.size.width, rootBounds.size.height);
+        monotonicallyIncreasingTime(), rootBounds.origin.x, rootBounds.origin.y, rootBounds.size.width, rootBounds.size.height);
 
     // Print layer tree from the root
     printLayer(this, 0);
index f12807be6366e65d5ffccd872e9d397d393fa04a..c99c8080d7ff329128e6792a760eb62978a8c72a 100644 (file)
@@ -638,7 +638,7 @@ bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList
     if (valueList.property() == AnimatedPropertyWebkitTransform)
         listsMatch = validateTransformOperations(valueList, hasBigRotation) >= 0;
 
-    const double currentTime = WTF::currentTime();
+    const double currentTime = monotonicallyIncreasingTime();
     m_animations.add(GraphicsLayerAnimation(keyframesName, valueList, boxSize, anim, currentTime - timeOffset, listsMatch));
     // m_animationStartTime is the time of the first real frame of animation, now or delayed by a negative offset.
     if (timeOffset > 0)
index 1704f477d1892c1989965fb9bfad03daecd73e25..d74477010a38b3b108fdc97896d69b0c7c975359 100644 (file)
@@ -42,7 +42,7 @@ TextureMapperFPSCounter::TextureMapperFPSCounter()
     m_fpsInterval = showFPSEnvironment.toDouble(&ok);
     if (ok && m_fpsInterval) {
         m_isShowingFPS = true;
-        m_fpsTimestamp = WTF::currentTime();
+        m_fpsTimestamp = monotonicallyIncreasingTime();
     }
 }
 
@@ -52,7 +52,7 @@ void TextureMapperFPSCounter::updateFPSAndDisplay(TextureMapper* textureMapper,
         return;
 
     m_frameCount++;
-    double delta = WTF::currentTime() - m_fpsTimestamp;
+    double delta = monotonicallyIncreasingTime() - m_fpsTimestamp;
     if (delta >= m_fpsInterval) {
         m_lastFPS = int(m_frameCount / delta);
         m_frameCount = 0;
index 7e70bbb0d4ace4489716b48a86b43e936923e273..77dc0e1e9b50e6161152610e4c85d5706bd35f47 100644 (file)
@@ -1216,7 +1216,7 @@ bool CoordinatedGraphicsLayer::addAnimation(const KeyframeValueList& valueList,
     if (valueList.property() == AnimatedPropertyWebkitTransform)
         listsMatch = validateTransformOperations(valueList, ignoredHasBigRotation) >= 0;
 
-    m_lastAnimationStartTime = WTF::currentTime() - delayAsNegativeTimeOffset;
+    m_lastAnimationStartTime = monotonicallyIncreasingTime() - delayAsNegativeTimeOffset;
     m_animations.add(GraphicsLayerAnimation(keyframesName, valueList, boxSize, anim, m_lastAnimationStartTime, listsMatch));
     m_animationStartedTimer.startOneShot(0);
     didChangeAnimations();
index 0ef2049ee9936f50c453a1c3c94da0234c457d59..98a5eb7f51d4562677afbf8a9a4735e387c624dd 100644 (file)
@@ -58,7 +58,7 @@ DNSResolveQueue::DNSResolveQueue()
 
 bool DNSResolveQueue::isUsingProxy()
 {
-    double time = currentTime();
+    double time = monotonicallyIncreasingTime();
     static const double minimumProxyCheckDelay = 5;
     if (time - m_lastProxyEnabledStatusCheckTime > minimumProxyCheckDelay) {
         m_lastProxyEnabledStatusCheckTime = time;
index c5f3081c0d647cd2c26c58dee3391f85ee22109e..b32728980ef0644214f071f9272f42ba18c7c318 100644 (file)
@@ -86,7 +86,7 @@ void PluginMessageThrottlerWin::appendMessage(HWND hWnd, UINT msg, WPARAM wParam
 
     // If it has been more than MessageDirectProcessingInterval between throttled messages,
     // go ahead and process a message directly.
-    double currentTime = WTF::currentTime();
+    double currentTime = monotonicallyIncreasingTime();
     if (currentTime - m_lastMessageTime > MessageDirectProcessingInterval) {
         processQueuedMessage();
         m_lastMessageTime = currentTime;
index 76f45057bb34baee9a98856dea3360f16f8d5a0d..0695bee805a40e4df22f617de17f966cf7c3b0cd 100644 (file)
@@ -415,7 +415,7 @@ void RenderLayerCompositor::didFlushChangesForLayer(RenderLayer* layer, const Gr
 void RenderLayerCompositor::didPaintBacking(RenderLayerBacking*)
 {
     FrameView& frameView = m_renderView.frameView();
-    frameView.setLastPaintTime(currentTime());
+    frameView.setLastPaintTime(monotonicallyIncreasingTime());
     if (frameView.milestonesPendingPaint() && !m_paintRelatedMilestonesTimer.isActive())
         m_paintRelatedMilestonesTimer.startOneShot(0);
 }
@@ -546,7 +546,7 @@ void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update
     double startTime = 0;
     if (compositingLogEnabled()) {
         ++m_rootLayerUpdateCount;
-        startTime = currentTime();
+        startTime = monotonicallyIncreasingTime();
     }
 #endif
 
@@ -598,7 +598,7 @@ void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update
     
 #if !LOG_DISABLED
     if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needGeometryUpdate)) {
-        double endTime = currentTime();
+        double endTime = monotonicallyIncreasingTime();
         LOG(Compositing, "Total layers   primary   secondary   obligatory backing (KB)   secondary backing(KB)   total backing (KB)  update time (ms)\n");
 
         LOG(Compositing, "%8d %11d %9d %20.2f %22.2f %22.2f %18.2f\n",
index ad1b338ad0308f999e625cb4980843368834896b..dc814a042fea4849b61b4fa29885bc87290602e9 100644 (file)
@@ -67,7 +67,7 @@ bool RenderProgress::canBeReplacedWithInlineRunIn() const
 
 double RenderProgress::animationProgress() const
 {
-    return m_animating ? (fmod((currentTime() - m_animationStartTime), m_animationDuration) / m_animationDuration) : 0;
+    return m_animating ? (fmod((monotonicallyIncreasingTime() - m_animationStartTime), m_animationDuration) / m_animationDuration) : 0;
 }
 
 bool RenderProgress::isDeterminate() const
@@ -94,7 +94,7 @@ void RenderProgress::updateAnimationState()
 
     m_animating = animating;
     if (m_animating) {
-        m_animationStartTime = currentTime();
+        m_animationStartTime = monotonicallyIncreasingTime();
         m_animationTimer.startOneShot(m_animationRepeatInterval);
     } else
         m_animationTimer.stop();
index 4df0ffb26972cc7bfbbb72a4861e74a26b6f4357..358a9e7d98e014193b10cdf4ca91866fa40e336f 100644 (file)
@@ -110,7 +110,7 @@ SMILTime SMILTimeContainer::elapsed() const
 {
     if (!m_beginTime)
         return 0;
-    return currentTime() - m_beginTime - m_accumulatedPauseTime;
+    return monotonicallyIncreasingTime() - m_beginTime - m_accumulatedPauseTime;
 }
 
 bool SMILTimeContainer::isActive() const
@@ -131,7 +131,7 @@ bool SMILTimeContainer::isStarted() const
 void SMILTimeContainer::begin()
 {
     ASSERT(!m_beginTime);
-    double now = currentTime();
+    double now = monotonicallyIncreasingTime();
 
     // If 'm_presetStartTime' is set, the timeline was modified via setElapsed() before the document began.
     // In this case pass on 'seekToTime=true' to updateAnimations().
@@ -148,7 +148,7 @@ void SMILTimeContainer::begin()
 void SMILTimeContainer::pause()
 {
     ASSERT(!isPaused());
-    m_pauseTime = currentTime();
+    m_pauseTime = monotonicallyIncreasingTime();
 
     if (m_beginTime)
         m_timer.stop();
@@ -159,7 +159,7 @@ void SMILTimeContainer::resume()
     ASSERT(isPaused());
 
     if (m_beginTime)
-        m_accumulatedPauseTime += currentTime() - m_pauseTime;
+        m_accumulatedPauseTime += monotonicallyIncreasingTime() - m_pauseTime;
 
     m_pauseTime = 0;
     startTimer(0);
@@ -176,7 +176,7 @@ void SMILTimeContainer::setElapsed(SMILTime time)
     if (m_beginTime)
         m_timer.stop();
 
-    double now = currentTime();
+    double now = monotonicallyIncreasingTime();
     m_beginTime = now - time.value();
 
     m_accumulatedPauseTime = 0;