| 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 "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
| 9 #include "core/timing/PerformanceBase.h" | 9 #include "core/timing/PerformanceBase.h" |
| 10 #include "core/timing/PerformanceEntry.h" | 10 #include "core/timing/PerformanceEntry.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 PerformanceObserver::PerformanceObserver(PerformanceBase* performance, Performan
ceObserverCallback* callback) | 25 PerformanceObserver::PerformanceObserver(PerformanceBase* performance, Performan
ceObserverCallback* callback) |
| 26 : m_callback(callback) | 26 : m_callback(callback) |
| 27 , m_performance(performance) | 27 , m_performance(performance) |
| 28 , m_filterOptions(PerformanceEntry::Invalid) | 28 , m_filterOptions(PerformanceEntry::Invalid) |
| 29 , m_isRegistered(false) | 29 , m_isRegistered(false) |
| 30 { | 30 { |
| 31 } | 31 } |
| 32 | 32 |
| 33 PerformanceObserver::~PerformanceObserver() | |
| 34 { | |
| 35 } | |
| 36 | |
| 37 void PerformanceObserver::observe(const PerformanceObserverInit& observerInit, E
xceptionState& exceptionState) | 33 void PerformanceObserver::observe(const PerformanceObserverInit& observerInit, E
xceptionState& exceptionState) |
| 38 { | 34 { |
| 39 if (!m_performance) { | 35 if (!m_performance) { |
| 40 exceptionState.throwTypeError("Window may be destroyed? Performance targ
et is invalid."); | 36 exceptionState.throwTypeError("Window may be destroyed? Performance targ
et is invalid."); |
| 41 return; | 37 return; |
| 42 } | 38 } |
| 43 | 39 |
| 44 PerformanceEntryTypeMask entryTypes = PerformanceEntry::Invalid; | 40 PerformanceEntryTypeMask entryTypes = PerformanceEntry::Invalid; |
| 45 if (observerInit.hasEntryTypes() && observerInit.entryTypes().size()) { | 41 if (observerInit.hasEntryTypes() && observerInit.entryTypes().size()) { |
| 46 const Vector<String>& sequence = observerInit.entryTypes(); | 42 const Vector<String>& sequence = observerInit.entryTypes(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 91 } |
| 96 | 92 |
| 97 DEFINE_TRACE(PerformanceObserver) | 93 DEFINE_TRACE(PerformanceObserver) |
| 98 { | 94 { |
| 99 visitor->trace(m_callback); | 95 visitor->trace(m_callback); |
| 100 visitor->trace(m_performance); | 96 visitor->trace(m_performance); |
| 101 visitor->trace(m_performanceEntries); | 97 visitor->trace(m_performanceEntries); |
| 102 } | 98 } |
| 103 | 99 |
| 104 } // namespace blink | 100 } // namespace blink |
| OLD | NEW |