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