| 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/PerformanceObserverCallback.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" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 void PerformanceObserver::disconnect() { | 64 void PerformanceObserver::disconnect() { |
| 65 if (performance_) { | 65 if (performance_) { |
| 66 performance_->UnregisterPerformanceObserver(*this); | 66 performance_->UnregisterPerformanceObserver(*this); |
| 67 } | 67 } |
| 68 performance_entries_.Clear(); | 68 performance_entries_.Clear(); |
| 69 is_registered_ = false; | 69 is_registered_ = false; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void PerformanceObserver::MaybeEnqueuePerformanceEntry( |
| 73 PerformanceEntry& entry) { |
| 74 if (FilterOptions() & entry.EntryTypeEnum()) { |
| 75 EnqueuePerformanceEntry(entry); |
| 76 } |
| 77 } |
| 78 |
| 72 void PerformanceObserver::EnqueuePerformanceEntry(PerformanceEntry& entry) { | 79 void PerformanceObserver::EnqueuePerformanceEntry(PerformanceEntry& entry) { |
| 73 ASSERT(IsMainThread()); | 80 ASSERT(IsMainThread()); |
| 74 performance_entries_.push_back(&entry); | 81 performance_entries_.push_back(&entry); |
| 75 if (performance_) | 82 if (performance_) |
| 76 performance_->ActivateObserver(*this); | 83 performance_->ActivateObserver(*this); |
| 77 } | 84 } |
| 78 | 85 |
| 79 bool PerformanceObserver::ShouldBeSuspended() const { | 86 bool PerformanceObserver::ShouldBeSuspended() const { |
| 80 return execution_context_->IsContextSuspended(); | 87 return execution_context_->IsContextSuspended(); |
| 81 } | 88 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 98 visitor->Trace(callback_); | 105 visitor->Trace(callback_); |
| 99 visitor->Trace(performance_); | 106 visitor->Trace(performance_); |
| 100 visitor->Trace(performance_entries_); | 107 visitor->Trace(performance_entries_); |
| 101 } | 108 } |
| 102 | 109 |
| 103 DEFINE_TRACE_WRAPPERS(PerformanceObserver) { | 110 DEFINE_TRACE_WRAPPERS(PerformanceObserver) { |
| 104 visitor->TraceWrappers(callback_); | 111 visitor->TraceWrappers(callback_); |
| 105 } | 112 } |
| 106 | 113 |
| 107 } // namespace blink | 114 } // namespace blink |
| OLD | NEW |