| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PerformanceObserver_h | 5 #ifndef PerformanceObserver_h |
| 6 #define PerformanceObserver_h | 6 #define PerformanceObserver_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "core/CoreExport.h" |
| 9 #include "core/timing/PerformanceEntry.h" | 10 #include "core/timing/PerformanceEntry.h" |
| 10 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 11 #include "wtf/Vector.h" | 12 #include "wtf/Vector.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class ExceptionState; | 16 class ExceptionState; |
| 16 class PerformanceBase; | 17 class PerformanceBase; |
| 17 class PerformanceObserverCallback; | 18 class PerformanceObserverCallback; |
| 18 class PerformanceObserver; | 19 class PerformanceObserver; |
| 19 class PerformanceObserverInit; | 20 class PerformanceObserverInit; |
| 20 | 21 |
| 21 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; | 22 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; |
| 22 | 23 |
| 23 class PerformanceObserver final : public GarbageCollected<PerformanceObserver>,
public ScriptWrappable { | 24 class CORE_EXPORT PerformanceObserver final : public GarbageCollected<Performanc
eObserver>, public ScriptWrappable { |
| 24 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
| 25 friend class PerformanceBase; | 26 friend class PerformanceBase; |
| 26 public: | 27 public: |
| 27 static PerformanceObserver* create(PerformanceBase*, PerformanceObserverCall
back*); | 28 static PerformanceObserver* create(PerformanceBase*, PerformanceObserverCall
back*); |
| 28 static void resumeSuspendedObservers(); | 29 static void resumeSuspendedObservers(); |
| 29 | 30 |
| 30 void observe(const PerformanceObserverInit&, ExceptionState&); | 31 void observe(const PerformanceObserverInit&, ExceptionState&); |
| 31 void disconnect(); | 32 void disconnect(); |
| 32 void enqueuePerformanceEntry(PerformanceEntry&); | 33 void enqueuePerformanceEntry(PerformanceEntry&); |
| 33 PerformanceEntryTypeMask filterOptions() const { return m_filterOptions; } | 34 PerformanceEntryTypeMask filterOptions() const { return m_filterOptions; } |
| 34 | 35 |
| 35 DECLARE_TRACE(); | 36 DECLARE_TRACE(); |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 explicit PerformanceObserver(PerformanceBase*, PerformanceObserverCallback*)
; | 39 explicit PerformanceObserver(PerformanceBase*, PerformanceObserverCallback*)
; |
| 39 void deliver(); | 40 void deliver(); |
| 40 bool shouldBeSuspended() const; | 41 bool shouldBeSuspended() const; |
| 41 | 42 |
| 42 Member<PerformanceObserverCallback> m_callback; | 43 Member<PerformanceObserverCallback> m_callback; |
| 43 WeakMember<PerformanceBase> m_performance; | 44 WeakMember<PerformanceBase> m_performance; |
| 44 PerformanceEntryVector m_performanceEntries; | 45 PerformanceEntryVector m_performanceEntries; |
| 45 PerformanceEntryTypeMask m_filterOptions; | 46 PerformanceEntryTypeMask m_filterOptions; |
| 46 bool m_isRegistered; | 47 bool m_isRegistered; |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 } // namespace blink | 50 } // namespace blink |
| 50 | 51 |
| 51 #endif // PerformanceObserver_h | 52 #endif // PerformanceObserver_h |
| OLD | NEW |