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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/timing/Performance.idl ('k') | Source/core/timing/PerformanceBase.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 17 matching lines...) Expand all
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #ifndef PerformanceBase_h 32 #ifndef PerformanceBase_h
33 #define PerformanceBase_h 33 #define PerformanceBase_h
34 34
35 #include "core/CoreExport.h" 35 #include "core/CoreExport.h"
36 #include "core/events/EventTarget.h" 36 #include "core/events/EventTarget.h"
37 #include "core/timing/PerformanceEntry.h" 37 #include "core/timing/PerformanceEntry.h"
38 #include "platform/Timer.h"
38 #include "platform/heap/Handle.h" 39 #include "platform/heap/Handle.h"
39 #include "wtf/RefCounted.h" 40 #include "wtf/RefCounted.h"
40 #include "wtf/RefPtr.h" 41 #include "wtf/RefPtr.h"
41 #include "wtf/text/WTFString.h" 42 #include "wtf/text/WTFString.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 class Document; 46 class Document;
46 class ExceptionState; 47 class ExceptionState;
48 class PerformanceObserver;
47 class PerformanceTiming; 49 class PerformanceTiming;
48 class ResourceTimingInfo; 50 class ResourceTimingInfo;
49 class UserTiming; 51 class UserTiming;
50 52
51 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; 53 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>;
54 using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>;
52 55
53 class CORE_EXPORT PerformanceBase : public RefCountedGarbageCollectedEventTarget WithInlineData<PerformanceBase> { 56 class CORE_EXPORT PerformanceBase : public RefCountedGarbageCollectedEventTarget WithInlineData<PerformanceBase> {
54 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PerformanceBase); 57 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PerformanceBase);
55 public: 58 public:
56 ~PerformanceBase() override; 59 ~PerformanceBase() override;
57 60
58 const AtomicString& interfaceName() const override; 61 const AtomicString& interfaceName() const override;
59 62
60 virtual PerformanceTiming* timing() const; 63 virtual PerformanceTiming* timing() const;
61 double now() const; 64 double now() const;
(...skipping 20 matching lines...) Expand all
82 void addRenderTiming(Document*, unsigned, double, double); 85 void addRenderTiming(Document*, unsigned, double, double);
83 86
84 void addCompositeTiming(Document*, unsigned, double); 87 void addCompositeTiming(Document*, unsigned, double);
85 88
86 void mark(const String& markName, ExceptionState&); 89 void mark(const String& markName, ExceptionState&);
87 void clearMarks(const String& markName); 90 void clearMarks(const String& markName);
88 91
89 void measure(const String& measureName, const String& startMark, const Strin g& endMark, ExceptionState&); 92 void measure(const String& measureName, const String& startMark, const Strin g& endMark, ExceptionState&);
90 void clearMeasures(const String& measureName); 93 void clearMeasures(const String& measureName);
91 94
95 void unregisterPerformanceObserver(PerformanceObserver&);
96 void registerPerformanceObserver(PerformanceObserver&);
97 void updatePerformanceObserverFilterOptions();
98 void activateObserver(PerformanceObserver&);
99 void resumeSuspendedObservers();
100
92 DECLARE_VIRTUAL_TRACE(); 101 DECLARE_VIRTUAL_TRACE();
93 102
94 protected: 103 protected:
104
95 explicit PerformanceBase(double timeOrigin); 105 explicit PerformanceBase(double timeOrigin);
96 bool isResourceTimingBufferFull(); 106 bool isResourceTimingBufferFull();
97 void addResourceTimingBuffer(PerformanceEntry*); 107 void addResourceTimingBuffer(PerformanceEntry&);
98 108
99 bool isFrameTimingBufferFull(); 109 bool isFrameTimingBufferFull();
100 void addFrameTimingBuffer(PerformanceEntry*); 110 void addFrameTimingBuffer(PerformanceEntry&);
111
112 void notifyObserversOfEntry(PerformanceEntry&);
113 bool hasObserverFor(PerformanceEntry::EntryType);
114
115 void deliverObservationsTimerFired(Timer<PerformanceBase>*);
101 116
102 PerformanceEntryVector m_frameTimingBuffer; 117 PerformanceEntryVector m_frameTimingBuffer;
103 unsigned m_frameTimingBufferSize; 118 unsigned m_frameTimingBufferSize;
104 PerformanceEntryVector m_resourceTimingBuffer; 119 PerformanceEntryVector m_resourceTimingBuffer;
105 unsigned m_resourceTimingBufferSize; 120 unsigned m_resourceTimingBufferSize;
106 double m_timeOrigin; 121 double m_timeOrigin;
107 122
108 Member<UserTiming> m_userTiming; 123 Member<UserTiming> m_userTiming;
124
125 PerformanceEntryTypeMask m_observerFilterOptions;
126 PerformanceObservers m_observers;
127 PerformanceObservers m_activeObservers;
128 PerformanceObservers m_suspendedObservers;
129 Timer<PerformanceBase> m_deliverObservationsTimer;
109 }; 130 };
110 131
111 } // namespace blink 132 } // namespace blink
112 133
113 #endif // PerformanceBase_h 134 #endif // PerformanceBase_h
OLDNEW
« 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