OLD | NEW |
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 Loading... |
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/dom/DOMHighResTimeStamp.h" | 36 #include "core/dom/DOMHighResTimeStamp.h" |
37 #include "core/events/EventTarget.h" | 37 #include "core/events/EventTarget.h" |
| 38 #include "core/loader/FrameLoaderTypes.h" |
38 #include "core/timing/PerformanceEntry.h" | 39 #include "core/timing/PerformanceEntry.h" |
| 40 #include "core/timing/PerformanceNavigationTiming.h" |
39 #include "platform/Timer.h" | 41 #include "platform/Timer.h" |
40 #include "platform/heap/Handle.h" | 42 #include "platform/heap/Handle.h" |
41 #include "wtf/Forward.h" | 43 #include "wtf/Forward.h" |
42 #include "wtf/HashSet.h" | 44 #include "wtf/HashSet.h" |
43 #include "wtf/ListHashSet.h" | 45 #include "wtf/ListHashSet.h" |
44 #include "wtf/Vector.h" | 46 #include "wtf/Vector.h" |
45 | 47 |
46 namespace blink { | 48 namespace blink { |
47 | 49 |
48 class DOMWindow; | 50 class DOMWindow; |
49 class ExceptionState; | 51 class ExceptionState; |
50 class LocalFrame; | 52 class LocalFrame; |
51 class PerformanceObserver; | 53 class PerformanceObserver; |
52 class PerformanceTiming; | 54 class PerformanceTiming; |
53 class ResourceTimingInfo; | 55 class ResourceTimingInfo; |
54 class UserTiming; | 56 class UserTiming; |
55 | 57 |
56 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; | 58 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; |
57 using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>; | 59 using PerformanceObservers = HeapListHashSet<Member<PerformanceObserver>>; |
58 | 60 |
59 class CORE_EXPORT PerformanceBase : public EventTargetWithInlineData { | 61 class CORE_EXPORT PerformanceBase : public EventTargetWithInlineData { |
| 62 friend class PerformanceBaseTest; |
| 63 |
60 public: | 64 public: |
61 ~PerformanceBase() override; | 65 ~PerformanceBase() override; |
62 | 66 |
63 const AtomicString& interfaceName() const override; | 67 const AtomicString& interfaceName() const override; |
64 | 68 |
65 virtual PerformanceTiming* timing() const; | 69 virtual PerformanceTiming* timing() const; |
66 | 70 |
67 virtual void updateLongTaskInstrumentation() {} | 71 virtual void updateLongTaskInstrumentation() {} |
68 | 72 |
69 // Reduce the resolution to 5µs to prevent timing attacks. See: | 73 // Reduce the resolution to 5µs to prevent timing attacks. See: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 void clearMeasures(const String& measureName); | 116 void clearMeasures(const String& measureName); |
113 | 117 |
114 void unregisterPerformanceObserver(PerformanceObserver&); | 118 void unregisterPerformanceObserver(PerformanceObserver&); |
115 void registerPerformanceObserver(PerformanceObserver&); | 119 void registerPerformanceObserver(PerformanceObserver&); |
116 void updatePerformanceObserverFilterOptions(); | 120 void updatePerformanceObserverFilterOptions(); |
117 void activateObserver(PerformanceObserver&); | 121 void activateObserver(PerformanceObserver&); |
118 void resumeSuspendedObservers(); | 122 void resumeSuspendedObservers(); |
119 | 123 |
120 DECLARE_VIRTUAL_TRACE(); | 124 DECLARE_VIRTUAL_TRACE(); |
121 | 125 |
| 126 private: |
| 127 static PerformanceNavigationTiming::NavigationType getNavigationType( |
| 128 NavigationType, |
| 129 const Document*); |
| 130 |
122 protected: | 131 protected: |
123 explicit PerformanceBase(double timeOrigin); | 132 explicit PerformanceBase(double timeOrigin); |
124 | 133 |
125 bool isResourceTimingBufferFull(); | 134 bool isResourceTimingBufferFull(); |
126 void addResourceTimingBuffer(PerformanceEntry&); | 135 void addResourceTimingBuffer(PerformanceEntry&); |
127 | 136 |
128 bool isFrameTimingBufferFull(); | 137 bool isFrameTimingBufferFull(); |
129 void addFrameTimingBuffer(PerformanceEntry&); | 138 void addFrameTimingBuffer(PerformanceEntry&); |
130 | 139 |
131 void notifyObserversOfEntry(PerformanceEntry&); | 140 void notifyObserversOfEntry(PerformanceEntry&); |
(...skipping 13 matching lines...) Expand all Loading... |
145 PerformanceEntryTypeMask m_observerFilterOptions; | 154 PerformanceEntryTypeMask m_observerFilterOptions; |
146 PerformanceObservers m_observers; | 155 PerformanceObservers m_observers; |
147 PerformanceObservers m_activeObservers; | 156 PerformanceObservers m_activeObservers; |
148 PerformanceObservers m_suspendedObservers; | 157 PerformanceObservers m_suspendedObservers; |
149 Timer<PerformanceBase> m_deliverObservationsTimer; | 158 Timer<PerformanceBase> m_deliverObservationsTimer; |
150 }; | 159 }; |
151 | 160 |
152 } // namespace blink | 161 } // namespace blink |
153 | 162 |
154 #endif // PerformanceBase_h | 163 #endif // PerformanceBase_h |
OLD | NEW |