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/TraceWrapperMember.h" | 8 #include "bindings/core/v8/TraceWrapperMember.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 ExecutionContext; |
16 class ExceptionState; | 17 class ExceptionState; |
17 class PerformanceBase; | 18 class PerformanceBase; |
18 class PerformanceObserver; | 19 class PerformanceObserver; |
19 class PerformanceObserverCallback; | 20 class PerformanceObserverCallback; |
20 class PerformanceObserverInit; | 21 class PerformanceObserverInit; |
21 class ScriptState; | |
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 PerformanceBaseTest; | 30 friend class PerformanceBaseTest; |
31 friend class PerformanceObserverTest; | 31 friend class PerformanceObserverTest; |
32 | 32 |
33 public: | 33 public: |
34 static PerformanceObserver* create(ScriptState*, | 34 static PerformanceObserver* create(ExecutionContext*, |
35 PerformanceBase*, | 35 PerformanceBase*, |
36 PerformanceObserverCallback*); | 36 PerformanceObserverCallback*); |
37 static void resumeSuspendedObservers(); | 37 static void resumeSuspendedObservers(); |
38 | 38 |
39 void observe(const PerformanceObserverInit&, ExceptionState&); | 39 void observe(const PerformanceObserverInit&, ExceptionState&); |
40 void disconnect(); | 40 void disconnect(); |
41 void enqueuePerformanceEntry(PerformanceEntry&); | 41 void enqueuePerformanceEntry(PerformanceEntry&); |
42 PerformanceEntryTypeMask filterOptions() const { return m_filterOptions; } | 42 PerformanceEntryTypeMask filterOptions() const { return m_filterOptions; } |
43 | 43 |
44 DECLARE_TRACE(); | 44 DECLARE_TRACE(); |
45 DECLARE_TRACE_WRAPPERS(); | 45 DECLARE_TRACE_WRAPPERS(); |
46 | 46 |
47 private: | 47 private: |
48 PerformanceObserver(ScriptState*, | 48 PerformanceObserver(ExecutionContext*, |
49 PerformanceBase*, | 49 PerformanceBase*, |
50 PerformanceObserverCallback*); | 50 PerformanceObserverCallback*); |
51 void deliver(); | 51 void deliver(); |
52 bool shouldBeSuspended() const; | 52 bool shouldBeSuspended() const; |
53 | 53 |
54 RefPtr<ScriptState> m_scriptState; | 54 Member<ExecutionContext> m_executionContext; |
55 TraceWrapperMember<PerformanceObserverCallback> m_callback; | 55 TraceWrapperMember<PerformanceObserverCallback> m_callback; |
56 WeakMember<PerformanceBase> m_performance; | 56 WeakMember<PerformanceBase> m_performance; |
57 PerformanceEntryVector m_performanceEntries; | 57 PerformanceEntryVector m_performanceEntries; |
58 PerformanceEntryTypeMask m_filterOptions; | 58 PerformanceEntryTypeMask m_filterOptions; |
59 bool m_isRegistered; | 59 bool m_isRegistered; |
60 }; | 60 }; |
61 | 61 |
62 } // namespace blink | 62 } // namespace blink |
63 | 63 |
64 #endif // PerformanceObserver_h | 64 #endif // PerformanceObserver_h |
OLD | NEW |