Chromium Code Reviews| 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/18 22:24:17
This is very unusual for blink code, can you retur
|
| 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); |
| } |