| 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/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.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" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void PerformanceObserver::enqueuePerformanceEntry(PerformanceEntry& entry) | 72 void PerformanceObserver::enqueuePerformanceEntry(PerformanceEntry& entry) |
| 73 { | 73 { |
| 74 ASSERT(isMainThread()); | 74 ASSERT(isMainThread()); |
| 75 m_performanceEntries.append(&entry); | 75 m_performanceEntries.append(&entry); |
| 76 if (m_performance) | 76 if (m_performance) |
| 77 m_performance->activateObserver(*this); | 77 m_performance->activateObserver(*this); |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool PerformanceObserver::shouldBeSuspended() const | 80 bool PerformanceObserver::shouldBeSuspended() const |
| 81 { | 81 { |
| 82 return m_callback->executionContext() && m_callback->executionContext()->act
iveDOMObjectsAreSuspended(); | 82 return m_callback->getExecutionContext() && m_callback->getExecutionContext(
)->activeDOMObjectsAreSuspended(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void PerformanceObserver::deliver() | 85 void PerformanceObserver::deliver() |
| 86 { | 86 { |
| 87 ASSERT(!shouldBeSuspended()); | 87 ASSERT(!shouldBeSuspended()); |
| 88 | 88 |
| 89 if (m_performanceEntries.isEmpty()) | 89 if (m_performanceEntries.isEmpty()) |
| 90 return; | 90 return; |
| 91 | 91 |
| 92 PerformanceEntryVector performanceEntries; | 92 PerformanceEntryVector performanceEntries; |
| 93 performanceEntries.swap(m_performanceEntries); | 93 performanceEntries.swap(m_performanceEntries); |
| 94 Member<PerformanceObserverEntryList> entryList(new PerformanceObserverEntryL
ist(performanceEntries)); | 94 Member<PerformanceObserverEntryList> entryList(new PerformanceObserverEntryL
ist(performanceEntries)); |
| 95 | 95 |
| 96 m_callback->handleEvent(entryList, this); | 96 m_callback->handleEvent(entryList, this); |
| 97 } | 97 } |
| 98 | 98 |
| 99 DEFINE_TRACE(PerformanceObserver) | 99 DEFINE_TRACE(PerformanceObserver) |
| 100 { | 100 { |
| 101 visitor->trace(m_callback); | 101 visitor->trace(m_callback); |
| 102 visitor->trace(m_performance); | 102 visitor->trace(m_performance); |
| 103 visitor->trace(m_performanceEntries); | 103 visitor->trace(m_performanceEntries); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |