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