| 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/timing/PerformanceEntry.h" | 9 #include "core/timing/PerformanceEntry.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 11 #include "wtf/Vector.h" | 11 #include "wtf/Vector.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class ExceptionState; | 15 class ExceptionState; |
| 16 class PerformanceBase; | 16 class PerformanceBase; |
| 17 class PerformanceObserverCallback; | 17 class PerformanceObserverCallback; |
| 18 class PerformanceObserver; | 18 class PerformanceObserver; |
| 19 class PerformanceObserverInit; | 19 class PerformanceObserverInit; |
| 20 | 20 |
| 21 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; | 21 using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; |
| 22 | 22 |
| 23 class PerformanceObserver final : public GarbageCollectedFinalized<PerformanceOb
server>, public ScriptWrappable { | 23 class PerformanceObserver final : public GarbageCollected<PerformanceObserver>,
public ScriptWrappable { |
| 24 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
| 25 friend class PerformanceBase; | 25 friend class PerformanceBase; |
| 26 public: | 26 public: |
| 27 static PerformanceObserver* create(PerformanceBase*, PerformanceObserverCall
back*); | 27 static PerformanceObserver* create(PerformanceBase*, PerformanceObserverCall
back*); |
| 28 static void resumeSuspendedObservers(); | 28 static void resumeSuspendedObservers(); |
| 29 | 29 |
| 30 ~PerformanceObserver(); | |
| 31 | |
| 32 void observe(const PerformanceObserverInit&, ExceptionState&); | 30 void observe(const PerformanceObserverInit&, ExceptionState&); |
| 33 void disconnect(); | 31 void disconnect(); |
| 34 void enqueuePerformanceEntry(PerformanceEntry&); | 32 void enqueuePerformanceEntry(PerformanceEntry&); |
| 35 PerformanceEntryTypeMask filterOptions() const { return m_filterOptions; } | 33 PerformanceEntryTypeMask filterOptions() const { return m_filterOptions; } |
| 36 | 34 |
| 37 // Eagerly finalized as destructor accesses heap object members. | |
| 38 EAGERLY_FINALIZE(); | |
| 39 DECLARE_TRACE(); | 35 DECLARE_TRACE(); |
| 40 | 36 |
| 41 private: | 37 private: |
| 42 explicit PerformanceObserver(PerformanceBase*, PerformanceObserverCallback*)
; | 38 explicit PerformanceObserver(PerformanceBase*, PerformanceObserverCallback*)
; |
| 43 void deliver(); | 39 void deliver(); |
| 44 bool shouldBeSuspended() const; | 40 bool shouldBeSuspended() const; |
| 45 | 41 |
| 46 Member<PerformanceObserverCallback> m_callback; | 42 Member<PerformanceObserverCallback> m_callback; |
| 47 WeakMember<PerformanceBase> m_performance; | 43 WeakMember<PerformanceBase> m_performance; |
| 48 PerformanceEntryVector m_performanceEntries; | 44 PerformanceEntryVector m_performanceEntries; |
| 49 PerformanceEntryTypeMask m_filterOptions; | 45 PerformanceEntryTypeMask m_filterOptions; |
| 50 bool m_isRegistered; | 46 bool m_isRegistered; |
| 51 }; | 47 }; |
| 52 | 48 |
| 53 } // namespace blink | 49 } // namespace blink |
| 54 | 50 |
| 55 #endif // PerformanceObserver_h | 51 #endif // PerformanceObserver_h |
| OLD | NEW |