| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void clearMeasures(const String& measureName); | 121 void clearMeasures(const String& measureName); |
| 118 | 122 |
| 119 void unregisterPerformanceObserver(PerformanceObserver&); | 123 void unregisterPerformanceObserver(PerformanceObserver&); |
| 120 void registerPerformanceObserver(PerformanceObserver&); | 124 void registerPerformanceObserver(PerformanceObserver&); |
| 121 void updatePerformanceObserverFilterOptions(); | 125 void updatePerformanceObserverFilterOptions(); |
| 122 void activateObserver(PerformanceObserver&); | 126 void activateObserver(PerformanceObserver&); |
| 123 void resumeSuspendedObservers(); | 127 void resumeSuspendedObservers(); |
| 124 | 128 |
| 125 DECLARE_VIRTUAL_TRACE(); | 129 DECLARE_VIRTUAL_TRACE(); |
| 126 | 130 |
| 131 private: |
| 132 static PerformanceNavigationTiming::NavigationType getNavigationType( |
| 133 NavigationType, |
| 134 const Document*); |
| 135 |
| 127 protected: | 136 protected: |
| 128 explicit PerformanceBase(double timeOrigin); | 137 explicit PerformanceBase(double timeOrigin); |
| 129 | 138 |
| 130 bool isResourceTimingBufferFull(); | 139 bool isResourceTimingBufferFull(); |
| 131 void addResourceTimingBuffer(PerformanceEntry&); | 140 void addResourceTimingBuffer(PerformanceEntry&); |
| 132 | 141 |
| 133 bool isFrameTimingBufferFull(); | 142 bool isFrameTimingBufferFull(); |
| 134 void addFrameTimingBuffer(PerformanceEntry&); | 143 void addFrameTimingBuffer(PerformanceEntry&); |
| 135 | 144 |
| 136 void notifyObserversOfEntry(PerformanceEntry&); | 145 void notifyObserversOfEntry(PerformanceEntry&); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 150 PerformanceEntryTypeMask m_observerFilterOptions; | 159 PerformanceEntryTypeMask m_observerFilterOptions; |
| 151 PerformanceObservers m_observers; | 160 PerformanceObservers m_observers; |
| 152 PerformanceObservers m_activeObservers; | 161 PerformanceObservers m_activeObservers; |
| 153 PerformanceObservers m_suspendedObservers; | 162 PerformanceObservers m_suspendedObservers; |
| 154 Timer<PerformanceBase> m_deliverObservationsTimer; | 163 Timer<PerformanceBase> m_deliverObservationsTimer; |
| 155 }; | 164 }; |
| 156 | 165 |
| 157 } // namespace blink | 166 } // namespace blink |
| 158 | 167 |
| 159 #endif // PerformanceBase_h | 168 #endif // PerformanceBase_h |
| OLD | NEW |