Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1572)

Unified Diff: Source/core/timing/PerformanceUserTiming.cpp

Issue 1198863006: First version of PerformanceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch from microtask to timer for firing events. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/timing/PerformanceUserTiming.cpp
diff --git a/Source/core/timing/PerformanceUserTiming.cpp b/Source/core/timing/PerformanceUserTiming.cpp
index 94121ab0bc87d5577e47c42c2a6e9690b5f44497..0d3790aae293b924e5302c82cd47be2ffa8949ca 100644
--- a/Source/core/timing/PerformanceUserTiming.cpp
+++ b/Source/core/timing/PerformanceUserTiming.cpp
@@ -81,8 +81,9 @@ UserTiming::UserTiming(PerformanceBase* performance)
{
}
-static void insertPerformanceEntry(PerformanceEntryMap& performanceEntryMap, PerformanceEntry* entry)
+static void insertPerformanceEntry(PerformanceEntryMap& performanceEntryMap, NewPerformanceEntryCallback callback, PerformanceEntry* entry)
{
+ (*callback)(entry);
esprehn 2015/07/24 08:23:13 This still feels very weird, but okay.
MikeB 2015/07/24 19:30:38 ok, I switched it around to return a pointer to th
PerformanceEntryMap::iterator it = performanceEntryMap.find(entry->name());
if (it != performanceEntryMap.end())
it->value.append(entry);
@@ -104,7 +105,7 @@ static void clearPeformanceEntries(PerformanceEntryMap& performanceEntryMap, con
performanceEntryMap.remove(name);
}
-void UserTiming::mark(const String& markName, ExceptionState& exceptionState)
+void UserTiming::mark(const String& markName, NewPerformanceEntryCallback callback, ExceptionState& exceptionState)
{
if (restrictedKeyMap().contains(markName)) {
exceptionState.throwDOMException(SyntaxError, "'" + markName + "' is part of the PerformanceTiming interface, and cannot be used as a mark name.");
@@ -113,7 +114,7 @@ void UserTiming::mark(const String& markName, ExceptionState& exceptionState)
TRACE_EVENT_COPY_MARK("blink.user_timing", markName.utf8().data());
double startTime = m_performance->now();
- insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, startTime));
+ insertPerformanceEntry(m_marksMap, callback, PerformanceMark::create(markName, startTime));
Platform::current()->histogramCustomCounts("PLT.UserTiming_Mark", static_cast<int>(startTime), 0, 600000, 100);
}
@@ -140,7 +141,7 @@ double UserTiming::findExistingMarkStartTime(const String& markName, ExceptionSt
return 0.0;
}
-void UserTiming::measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState& exceptionState)
+void UserTiming::measure(const String& measureName, const String& startMark, const String& endMark, NewPerformanceEntryCallback callback, ExceptionState& exceptionState)
{
double startTime = 0.0;
double endTime = 0.0;
@@ -170,7 +171,7 @@ void UserTiming::measure(const String& measureName, const String& startMark, con
TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0("blink.user_timing", measureName.utf8().data(), WTF::StringHash::hash(measureName), startTimeMonotonic);
TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TIMESTAMP0("blink.user_timing", measureName.utf8().data(), WTF::StringHash::hash(measureName), endTimeMonotonic);
- insertPerformanceEntry(m_measuresMap, PerformanceMeasure::create(measureName, startTime, endTime));
+ insertPerformanceEntry(m_measuresMap, callback, PerformanceMeasure::create(measureName, startTime, endTime));
if (endTime >= startTime)
Platform::current()->histogramCustomCounts("PLT.UserTiming_MeasureDuration", static_cast<int>(endTime - startTime), 0, 600000, 100);
}

Powered by Google App Engine
This is Rietveld 408576698