<https://webkit.org/b/119785> Replace currentTime() with monotonicallyIncreasingTime() in WebCore
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: http://svn.webkit.org/repository/webkit/trunk@154201 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index 72fbbbf..6b0ac29 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -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
diff --git a/Source/WTF/wtf/CurrentTime.h b/Source/WTF/wtf/CurrentTime.h
index 2a60eda..24b2a30 100644
--- a/Source/WTF/wtf/CurrentTime.h
+++ b/Source/WTF/wtf/CurrentTime.h
@@ -39,6 +39,8 @@
// 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 @@
// 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 @@
using WTF::currentTime;
using WTF::currentTimeMS;
using WTF::monotonicallyIncreasingTime;
+using WTF::monotonicallyIncreasingTimeMS;
using WTF::currentCPUTime;
#endif // CurrentTime_h
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 881d008..81eede1 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -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.
diff --git a/Source/WebCore/Modules/filesystem/FileWriter.cpp b/Source/WebCore/Modules/filesystem/FileWriter.cpp
index 841e69b..38ab598 100644
--- a/Source/WebCore/Modules/filesystem/FileWriter.cpp
+++ b/Source/WebCore/Modules/filesystem/FileWriter.cpp
@@ -203,7 +203,7 @@
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);
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index b14a7d6..f1d8e99 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -424,7 +424,7 @@
, 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::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::resetLastHandledUserGestureTimestamp()
{
- m_lastHandledUserGestureTimestamp = currentTime();
+ m_lastHandledUserGestureTimestamp = monotonicallyIncreasingTime();
}
HTMLIFrameElement* Document::seamlessParentIFrame() const
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp
index a8ece1c..1e50b06 100644
--- a/Source/WebCore/dom/Element.cpp
+++ b/Source/WebCore/dom/Element.cpp
@@ -486,7 +486,7 @@
// "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 @@
// 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
diff --git a/Source/WebCore/fileapi/FileReader.cpp b/Source/WebCore/fileapi/FileReader.cpp
index f696775..6b1c86f 100644
--- a/Source/WebCore/fileapi/FileReader.cpp
+++ b/Source/WebCore/fileapi/FileReader.cpp
@@ -204,7 +204,7 @@
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) {
diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp
index 890d14b1..6830fca 100644
--- a/Source/WebCore/html/HTMLMediaElement.cpp
+++ b/Source/WebCore/html/HTMLMediaElement.cpp
@@ -267,7 +267,7 @@
, 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 @@
, 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 @@
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 @@
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 @@
void HTMLMediaElement::refreshCachedTime() const
{
m_cachedTime = m_player->currentTime();
- m_cachedTimeWallClockUpdateTime = WTF::currentTime();
+ m_clockTimeAtLastCachedTimeUpdate = monotonicallyIncreasingTime();
}
void HTMLMediaElement::invalidateCachedTime()
@@ -2272,7 +2272,7 @@
// 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 @@
}
// 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 @@
}
#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 @@
if (m_playbackProgressTimer.isActive())
return;
- m_previousProgressTime = WTF::currentTime();
+ m_previousProgressTime = monotonicallyIncreasingTime();
m_playbackProgressTimer.startRepeating(maxTimeupdateEventFrequency);
}
@@ -2827,8 +2827,8 @@
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 @@
double movieTime = currentTime();
if (movieTime != m_lastTimeUpdateEventMovieTime) {
scheduleEvent(eventNames().timeupdateEvent);
- m_lastTimeUpdateEventWallTime = now;
+ m_clockTimeAtLastUpdateEvent = now;
m_lastTimeUpdateEventMovieTime = movieTime;
}
}
diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h
index c63069a..299380f 100644
--- a/Source/WebCore/html/HTMLMediaElement.h
+++ b/Source/WebCore/html/HTMLMediaElement.h
@@ -641,8 +641,8 @@
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 @@
#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;
diff --git a/Source/WebCore/html/HTMLPlugInImageElement.cpp b/Source/WebCore/html/HTMLPlugInImageElement.cpp
index 2a3d879..57afc63 100644
--- a/Source/WebCore/html/HTMLPlugInImageElement.cpp
+++ b/Source/WebCore/html/HTMLPlugInImageElement.cpp
@@ -547,7 +547,7 @@
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;
diff --git a/Source/WebCore/html/MediaController.cpp b/Source/WebCore/html/MediaController.cpp
index cbfa21d..b8a585d 100644
--- a/Source/WebCore/html/MediaController.cpp
+++ b/Source/WebCore/html/MediaController.cpp
@@ -673,7 +673,7 @@
void MediaController::scheduleTimeupdateEvent()
{
- double now = WTF::currentTime();
+ double now = monotonicallyIncreasingTime();
double timedelta = now - m_previousTimeupdateTime;
if (timedelta < maxTimeupdateEventFrequency)
diff --git a/Source/WebCore/html/parser/HTMLDocumentParser.cpp b/Source/WebCore/html/parser/HTMLDocumentParser.cpp
index ace72d8..58866e3 100644
--- a/Source/WebCore/html/parser/HTMLDocumentParser.cpp
+++ b/Source/WebCore/html/parser/HTMLDocumentParser.cpp
@@ -468,7 +468,7 @@
// 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 @@
if (isWaitingForScripts() || isStopped())
break;
- if (currentTime() - startTime > parserTimeLimit && !m_speculations.isEmpty()) {
+ if (monotonicallyIncreasingTime() - startTime > parserTimeLimit && !m_speculations.isEmpty()) {
m_parserScheduler->scheduleForResume();
break;
}
diff --git a/Source/WebCore/html/parser/HTMLParserScheduler.h b/Source/WebCore/html/parser/HTMLParserScheduler.h
index 8256cf4..2ca7222 100644
--- a/Source/WebCore/html/parser/HTMLParserScheduler.h
+++ b/Source/WebCore/html/parser/HTMLParserScheduler.h
@@ -73,12 +73,12 @@
// 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;
}
diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp
index f0e6db7..625fdaf 100644
--- a/Source/WebCore/inspector/InspectorCSSAgent.cpp
+++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp
@@ -109,14 +109,14 @@
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 @@
// 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 @@
}
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::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
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
index ad4cebd..322eb99 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
@@ -491,7 +491,7 @@
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 @@
{
if (!m_profileNameIdleTimeMap || !m_profileNameIdleTimeMap->size())
return;
- m_previousTaskEndTime = WTF::monotonicallyIncreasingTime();
+ m_previousTaskEndTime = monotonicallyIncreasingTime();
}
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.cpp b/Source/WebCore/inspector/InspectorTimelineAgent.cpp
index 2426355..a0188f4 100644
--- a/Source/WebCore/inspector/InspectorTimelineAgent.cpp
+++ b/Source/WebCore/inspector/InspectorTimelineAgent.cpp
@@ -718,7 +718,7 @@
double InspectorTimelineAgent::timestamp()
{
- return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyIncreasingTime());
+ return m_timeConverter.fromMonotonicallyIncreasingTime(monotonicallyIncreasingTime());
}
Page* InspectorTimelineAgent::page()
diff --git a/Source/WebCore/inspector/TimelineTraceEventProcessor.cpp b/Source/WebCore/inspector/TimelineTraceEventProcessor.cpp
index 05f7c09..5d11508 100644
--- a/Source/WebCore/inspector/TimelineTraceEventProcessor.cpp
+++ b/Source/WebCore/inspector/TimelineTraceEventProcessor.cpp
@@ -213,7 +213,7 @@
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);
diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp
index 1e6e4b9..c7003ba 100644
--- a/Source/WebCore/page/FrameView.cpp
+++ b/Source/WebCore/page/FrameView.cpp
@@ -2330,7 +2330,7 @@
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 @@
bool isTopLevelPainter = !sCurrentPaintTimeStamp;
if (isTopLevelPainter)
- sCurrentPaintTimeStamp = currentTime();
+ sCurrentPaintTimeStamp = monotonicallyIncreasingTime();
FontCachePurgePreventer fontCachePurgePreventer;
@@ -3581,7 +3581,7 @@
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)
diff --git a/Source/WebCore/platform/ClockGeneric.cpp b/Source/WebCore/platform/ClockGeneric.cpp
index 99aa340..fac2267 100644
--- a/Source/WebCore/platform/ClockGeneric.cpp
+++ b/Source/WebCore/platform/ClockGeneric.cpp
@@ -79,5 +79,5 @@
double ClockGeneric::now() const
{
- return WTF::currentTime();
+ return monotonicallyIncreasingTime();
}
diff --git a/Source/WebCore/platform/ScrollAnimatorNone.cpp b/Source/WebCore/platform/ScrollAnimatorNone.cpp
index 5607524..dc3381b 100644
--- a/Source/WebCore/platform/ScrollAnimatorNone.cpp
+++ b/Source/WebCore/platform/ScrollAnimatorNone.cpp
@@ -454,7 +454,7 @@
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(), ¶meters);
+ bool needToScroll = data.updateDataFromParameters(step, multiplier, scrollableSize, monotonicallyIncreasingTime(), ¶meters);
if (needToScroll && !animationTimerActive()) {
m_startTime = data.m_startTime;
animationWillStart();
@@ -523,7 +523,7 @@
void ScrollAnimatorNone::animationTimerFired()
{
- double currentTime = WTF::monotonicallyIncreasingTime();
+ double currentTime = monotonicallyIncreasingTime();
double deltaToNextFrame = ceil((currentTime - m_startTime) * kFrameRate) / kFrameRate - (currentTime - m_startTime);
currentTime += deltaToNextFrame;
diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
index 5072739..49d9eb4 100644
--- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
+++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
@@ -182,7 +182,7 @@
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 @@
#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 @@
{
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 @@
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