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 #include "core/timing/PerformanceObserver.h" | 5 #include "core/timing/PerformanceObserver.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/V8PerformanceObserverCallback.h" | 8 #include "bindings/core/v8/PerformanceObserverCallback.h" |
9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
10 #include "core/timing/PerformanceBase.h" | 10 #include "core/timing/PerformanceBase.h" |
11 #include "core/timing/PerformanceEntry.h" | 11 #include "core/timing/PerformanceEntry.h" |
12 #include "core/timing/PerformanceObserverEntryList.h" | 12 #include "core/timing/PerformanceObserverEntryList.h" |
13 #include "core/timing/PerformanceObserverInit.h" | 13 #include "core/timing/PerformanceObserverInit.h" |
14 #include "platform/Timer.h" | 14 #include "platform/Timer.h" |
15 #include <algorithm> | 15 #include <algorithm> |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 PerformanceObserver* PerformanceObserver::create( | 19 PerformanceObserver* PerformanceObserver::create( |
20 ScriptState* scriptState, | 20 ScriptState* scriptState, |
21 PerformanceBase* performance, | 21 PerformanceBase* performance, |
22 V8PerformanceObserverCallback* callback) { | 22 PerformanceObserverCallback* callback) { |
23 ASSERT(isMainThread()); | 23 ASSERT(isMainThread()); |
24 return new PerformanceObserver(scriptState, performance, callback); | 24 return new PerformanceObserver(scriptState, performance, callback); |
25 } | 25 } |
26 | 26 |
27 PerformanceObserver::PerformanceObserver( | 27 PerformanceObserver::PerformanceObserver(ScriptState* scriptState, |
28 ScriptState* scriptState, | 28 PerformanceBase* performance, |
29 PerformanceBase* performance, | 29 PerformanceObserverCallback* callback) |
30 V8PerformanceObserverCallback* callback) | |
31 : m_scriptState(scriptState), | 30 : m_scriptState(scriptState), |
32 m_callback(callback), | 31 m_callback(callback), |
33 m_performance(performance), | 32 m_performance(performance), |
34 m_filterOptions(PerformanceEntry::Invalid), | 33 m_filterOptions(PerformanceEntry::Invalid), |
35 m_isRegistered(false) {} | 34 m_isRegistered(false) {} |
36 | 35 |
37 void PerformanceObserver::observe(const PerformanceObserverInit& observerInit, | 36 void PerformanceObserver::observe(const PerformanceObserverInit& observerInit, |
38 ExceptionState& exceptionState) { | 37 ExceptionState& exceptionState) { |
39 if (!m_performance) { | 38 if (!m_performance) { |
40 exceptionState.throwTypeError( | 39 exceptionState.throwTypeError( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 m_callback->call(m_scriptState.get(), this, exceptionState, entryList, this); | 96 m_callback->call(m_scriptState.get(), this, exceptionState, entryList, this); |
98 } | 97 } |
99 | 98 |
100 DEFINE_TRACE(PerformanceObserver) { | 99 DEFINE_TRACE(PerformanceObserver) { |
101 visitor->trace(m_callback); | 100 visitor->trace(m_callback); |
102 visitor->trace(m_performance); | 101 visitor->trace(m_performance); |
103 visitor->trace(m_performanceEntries); | 102 visitor->trace(m_performanceEntries); |
104 } | 103 } |
105 | 104 |
106 } // namespace blink | 105 } // namespace blink |
OLD | NEW |