| 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/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 19 matching lines...) Expand all Loading... |
| 81 void addRenderTiming(Document*, unsigned, double, double); | 84 void addRenderTiming(Document*, unsigned, double, double); |
| 82 | 85 |
| 83 void addCompositeTiming(Document*, unsigned, double); | 86 void addCompositeTiming(Document*, unsigned, double); |
| 84 | 87 |
| 85 void mark(const String& markName, ExceptionState&); | 88 void mark(const String& markName, ExceptionState&); |
| 86 void clearMarks(const String& markName); | 89 void clearMarks(const String& markName); |
| 87 | 90 |
| 88 void measure(const String& measureName, const String& startMark, const Strin
g& endMark, ExceptionState&); | 91 void measure(const String& measureName, const String& startMark, const Strin
g& endMark, ExceptionState&); |
| 89 void clearMeasures(const String& measureName); | 92 void clearMeasures(const String& measureName); |
| 90 | 93 |
| 94 void unregisterPerformanceObserver(PerformanceObserver&); |
| 95 void registerPerformanceObserver(PerformanceObserver&); |
| 96 void activateObserver(PerformanceObserver&); |
| 97 void resumeSuspendedObservers(); |
| 98 |
| 91 DECLARE_VIRTUAL_TRACE(); | 99 DECLARE_VIRTUAL_TRACE(); |
| 92 | 100 |
| 93 protected: | 101 protected: |
| 102 |
| 94 explicit PerformanceBase(double timeOrigin); | 103 explicit PerformanceBase(double timeOrigin); |
| 95 bool isResourceTimingBufferFull(); | 104 bool isResourceTimingBufferFull(); |
| 96 void addResourceTimingBuffer(PerformanceEntry*); | 105 void addResourceTimingBuffer(PerformanceEntry&); |
| 97 | 106 |
| 98 bool isFrameTimingBufferFull(); | 107 bool isFrameTimingBufferFull(); |
| 99 void addFrameTimingBuffer(PerformanceEntry*); | 108 void addFrameTimingBuffer(PerformanceEntry&); |
| 109 |
| 110 void notifyObserversOfEntry(PerformanceEntry&); |
| 111 bool hasObserverFor(PerformanceEntry::EntryType); |
| 112 |
| 113 void deliverObservationsTimerFired(Timer<PerformanceBase>*); |
| 100 | 114 |
| 101 PerformanceEntryVector m_frameTimingBuffer; | 115 PerformanceEntryVector m_frameTimingBuffer; |
| 102 unsigned m_frameTimingBufferSize; | 116 unsigned m_frameTimingBufferSize; |
| 103 PerformanceEntryVector m_resourceTimingBuffer; | 117 PerformanceEntryVector m_resourceTimingBuffer; |
| 104 unsigned m_resourceTimingBufferSize; | 118 unsigned m_resourceTimingBufferSize; |
| 105 double m_timeOrigin; | 119 double m_timeOrigin; |
| 106 | 120 |
| 107 Member<UserTiming> m_userTiming; | 121 Member<UserTiming> m_userTiming; |
| 122 |
| 123 PerformanceEntryTypeMask m_observerFilterOptions; |
| 124 PerformanceObservers m_observers; |
| 125 PerformanceObservers m_activeObservers; |
| 126 PerformanceObservers m_suspendedObservers; |
| 127 Timer<PerformanceBase> m_deliverObservationsTimer; |
| 108 }; | 128 }; |
| 109 | 129 |
| 110 } // namespace blink | 130 } // namespace blink |
| 111 | 131 |
| 112 #endif // PerformanceBase_h | 132 #endif // PerformanceBase_h |
| OLD | NEW |