Chromium Code Reviews| Index: Source/core/timing/PerformanceBase.h |
| diff --git a/Source/core/timing/PerformanceBase.h b/Source/core/timing/PerformanceBase.h |
| index 344ee39bd06f292308b24db49d8b58f9d2d4ff84..2562162798eb6822a6b517fc1f7d76e7f5a5c829 100644 |
| --- a/Source/core/timing/PerformanceBase.h |
| +++ b/Source/core/timing/PerformanceBase.h |
| @@ -32,6 +32,7 @@ |
| #ifndef PerformanceBase_h |
| #define PerformanceBase_h |
| +#include "bindings/core/v8/V8PerformanceObserverCallback.h" |
| #include "core/CoreExport.h" |
| #include "core/events/EventTarget.h" |
| #include "core/timing/PerformanceEntry.h" |
| @@ -44,11 +45,16 @@ namespace blink { |
| class Document; |
| class ExceptionState; |
| +class PerformanceObserver; |
| +class PerformanceObserverRegistration; |
| class PerformanceTiming; |
| class ResourceTimingInfo; |
| class UserTiming; |
| using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; |
| +using PerformanceObserverRegistrationVector = HeapVector<Member<PerformanceObserverRegistration>>; |
| +using FilterTypeIndex = size_t; |
| +using PerformanceObserverRegistrations = HeapHashMap<FilterTypeIndex, PerformanceObserverRegistrationVector>; |
| class CORE_EXPORT PerformanceBase : public RefCountedGarbageCollectedEventTargetWithInlineData<PerformanceBase> { |
| REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PerformanceBase); |
| @@ -88,9 +94,21 @@ public: |
| void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState&); |
| void clearMeasures(const String& measureName); |
| + PerformanceObserver* createPerformanceObserver(PerformanceObserverCallback*); |
| + void unregisterPerformanceObserver(PerformanceObserverRegistration*); |
| + void registerPerformanceObserver(PerformanceObserverRegistration*); |
| + |
| DECLARE_VIRTUAL_TRACE(); |
| protected: |
| + enum FilterType { |
| + Composite = 1, |
|
esprehn
2015/07/18 22:24:16
UnknownFilter, or maybe InvalidFilter
CompositeFil
MikeB
2015/07/20 23:06:50
Done.
|
| + Mark, |
| + Measure, |
| + Render, |
| + Resource, |
| + }; |
| + |
| explicit PerformanceBase(double timeOrigin); |
| bool isResourceTimingBufferFull(); |
| void addResourceTimingBuffer(PerformanceEntry*); |
| @@ -98,6 +116,9 @@ protected: |
| bool isFrameTimingBufferFull(); |
| void addFrameTimingBuffer(PerformanceEntry*); |
| + void notifyObserversOfEntry(FilterType, PerformanceEntry*); |
| + bool hasObserverFor(FilterType); |
| + |
| PerformanceEntryVector m_frameTimingBuffer; |
| unsigned m_frameTimingBufferSize; |
| PerformanceEntryVector m_resourceTimingBuffer; |
| @@ -105,6 +126,8 @@ protected: |
| double m_timeOrigin; |
| Member<UserTiming> m_userTiming; |
| + |
| + PerformanceObserverRegistrations m_observerRegistry; |
| }; |
| } // namespace blink |