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

Unified Diff: Source/core/timing/PerformanceBase.h

Issue 1198863006: First version of PerformanceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review comments Created 5 years, 3 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
« no previous file with comments | « Source/core/timing/Performance.idl ('k') | Source/core/timing/PerformanceBase.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/timing/PerformanceBase.h
diff --git a/Source/core/timing/PerformanceBase.h b/Source/core/timing/PerformanceBase.h
index 6ea407086c2363ee6ca2dfaaaee00b6bbcb0e5ee..cd56537ea910464925457528c0340c59e0091624 100644
--- a/Source/core/timing/PerformanceBase.h
+++ b/Source/core/timing/PerformanceBase.h
@@ -35,6 +35,7 @@
#include "core/CoreExport.h"
#include "core/events/EventTarget.h"
#include "core/timing/PerformanceEntry.h"
+#include "platform/Timer.h"
#include "platform/heap/Handle.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
@@ -44,11 +45,13 @@ namespace blink {
class Document;
class ExceptionState;
+class PerformanceObserver;
class PerformanceTiming;
class ResourceTimingInfo;
class UserTiming;
using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>;
+using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>;
class CORE_EXPORT PerformanceBase : public RefCountedGarbageCollectedEventTargetWithInlineData<PerformanceBase> {
REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PerformanceBase);
@@ -89,15 +92,27 @@ public:
void measure(const String& measureName, const String& startMark, const String& endMark, ExceptionState&);
void clearMeasures(const String& measureName);
+ void unregisterPerformanceObserver(PerformanceObserver&);
+ void registerPerformanceObserver(PerformanceObserver&);
+ void updatePerformanceObserverFilterOptions();
+ void activateObserver(PerformanceObserver&);
+ void resumeSuspendedObservers();
+
DECLARE_VIRTUAL_TRACE();
protected:
+
explicit PerformanceBase(double timeOrigin);
bool isResourceTimingBufferFull();
- void addResourceTimingBuffer(PerformanceEntry*);
+ void addResourceTimingBuffer(PerformanceEntry&);
bool isFrameTimingBufferFull();
- void addFrameTimingBuffer(PerformanceEntry*);
+ void addFrameTimingBuffer(PerformanceEntry&);
+
+ void notifyObserversOfEntry(PerformanceEntry&);
+ bool hasObserverFor(PerformanceEntry::EntryType);
+
+ void deliverObservationsTimerFired(Timer<PerformanceBase>*);
PerformanceEntryVector m_frameTimingBuffer;
unsigned m_frameTimingBufferSize;
@@ -106,6 +121,12 @@ protected:
double m_timeOrigin;
Member<UserTiming> m_userTiming;
+
+ PerformanceEntryTypeMask m_observerFilterOptions;
+ PerformanceObservers m_observers;
+ PerformanceObservers m_activeObservers;
+ PerformanceObservers m_suspendedObservers;
+ Timer<PerformanceBase> m_deliverObservationsTimer;
};
} // namespace blink
« no previous file with comments | « Source/core/timing/Performance.idl ('k') | Source/core/timing/PerformanceBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698