Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceObserver.cpp

Issue 2343553005: enable / disable Long Task instrumentation based on presence of LongTask observer (Closed)
Patch Set: remove check in dtor Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 if (entryTypes == PerformanceEntry::Invalid) { 46 if (entryTypes == PerformanceEntry::Invalid) {
47 exceptionState.throwTypeError("A Performance Observer MUST have a non-em pty entryTypes attribute."); 47 exceptionState.throwTypeError("A Performance Observer MUST have a non-em pty entryTypes attribute.");
48 return; 48 return;
49 } 49 }
50 m_filterOptions = entryTypes; 50 m_filterOptions = entryTypes;
51 if (m_isRegistered) 51 if (m_isRegistered)
52 m_performance->updatePerformanceObserverFilterOptions(); 52 m_performance->updatePerformanceObserverFilterOptions();
53 else 53 else
54 m_performance->registerPerformanceObserver(*this); 54 m_performance->registerPerformanceObserver(*this);
55 m_performance->enableLongTaskInstrumentation();
caseq 2016/09/19 22:18:06 Should we rather make this part of PerformanceBase
panicker 2016/09/20 12:00:39 Yes, I started with that in this CL, but the issue
55 m_isRegistered = true; 56 m_isRegistered = true;
56 } 57 }
57 58
58 void PerformanceObserver::disconnect() 59 void PerformanceObserver::disconnect()
59 { 60 {
60 if (m_performance) 61 if (m_performance) {
61 m_performance->unregisterPerformanceObserver(*this); 62 m_performance->unregisterPerformanceObserver(*this);
62 63 m_performance->disableLongTaskInstrumentation();
caseq 2016/09/19 22:18:06 ditto, consider moving to PerformanceBase::unregis
panicker 2016/09/20 12:00:39 Done.
64 }
63 m_performanceEntries.clear(); 65 m_performanceEntries.clear();
64 m_isRegistered = false; 66 m_isRegistered = false;
65 } 67 }
66 68
67 void PerformanceObserver::enqueuePerformanceEntry(PerformanceEntry& entry) 69 void PerformanceObserver::enqueuePerformanceEntry(PerformanceEntry& entry)
68 { 70 {
69 ASSERT(isMainThread()); 71 ASSERT(isMainThread());
70 m_performanceEntries.append(&entry); 72 m_performanceEntries.append(&entry);
71 if (m_performance) 73 if (m_performance)
72 m_performance->activateObserver(*this); 74 m_performance->activateObserver(*this);
(...skipping 19 matching lines...) Expand all
92 } 94 }
93 95
94 DEFINE_TRACE(PerformanceObserver) 96 DEFINE_TRACE(PerformanceObserver)
95 { 97 {
96 visitor->trace(m_callback); 98 visitor->trace(m_callback);
97 visitor->trace(m_performance); 99 visitor->trace(m_performance);
98 visitor->trace(m_performanceEntries); 100 visitor->trace(m_performanceEntries);
99 } 101 }
100 102
101 } // namespace blink 103 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698