Replace currentTime() with monotonicallyIncreasingTime() in WebCore

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: http://svn.webkit.org/repository/webkit/trunk@154706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6d96e5f5
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
......
......@@ -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()
......
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
......@@ -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
......@@ -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();
......
......@@ -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;
......
......@@ -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();
}
......
......@@ -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);
......
......@@ -173,7 +173,7 @@ PassRefPtr<StyleSheetContents> CachedCSSStyleSheet::restoreParsedStyleSheet(cons
if (m_parsedStyleSheetCache->parserContext() != context)
return 0;
didAccessDecodedData(currentTime());
didAccessDecodedData(monotonicallyIncreasingTime());
return m_parsedStyleSheetCache;
}
......
......@@ -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);
}
......
......@@ -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.
......
......@@ -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;
......
......@@ -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.
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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();
}
......
......@@ -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
......
......@@ -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)
......
......@@ -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);
......
......@@ -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)
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
......
......@@ -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;
......
......@@ -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",
......
......@@ -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();
......
......@@ -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;
}