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

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

Issue 2343553005: enable / disable Long Task instrumentation based on presence of LongTask observer (Closed)
Patch Set: address review comments 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 15 matching lines...) Expand all
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #include "core/timing/Performance.h" 32 #include "core/timing/Performance.h"
33 33
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/frame/LocalFrame.h" 35 #include "core/frame/LocalFrame.h"
36 #include "core/inspector/InspectedFrames.h"
37 #include "core/inspector/InspectorWebPerfAgent.h"
36 #include "core/loader/DocumentLoader.h" 38 #include "core/loader/DocumentLoader.h"
37 #include "core/timing/PerformanceTiming.h" 39 #include "core/timing/PerformanceTiming.h"
38 40
39 namespace blink { 41 namespace blink {
40 42
41 static double toTimeOrigin(LocalFrame* frame) 43 static double toTimeOrigin(LocalFrame* frame)
42 { 44 {
43 if (!frame) 45 if (!frame)
44 return 0.0; 46 return 0.0;
45 47
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 87 }
86 88
87 PerformanceTiming* Performance::timing() const 89 PerformanceTiming* Performance::timing() const
88 { 90 {
89 if (!m_timing) 91 if (!m_timing)
90 m_timing = PerformanceTiming::create(m_frame); 92 m_timing = PerformanceTiming::create(m_frame);
91 93
92 return m_timing.get(); 94 return m_timing.get();
93 } 95 }
94 96
97 void Performance::updateLongTaskInstrumentation()
98 {
99 if (hasObserverFor(PerformanceEntry::LongTask) && !m_longTaskInspectorAgent) {
100 m_longTaskInspectorAgent = new InspectorWebPerfAgent(
101 InspectedFrames::create(frame()));
102 m_longTaskInspectorAgent->enable();
103 } else if (!hasObserverFor(PerformanceEntry::LongTask) && m_longTaskInspecto rAgent) {
104 m_longTaskInspectorAgent->disable();
105 m_longTaskInspectorAgent = nullptr;
106 }
107 }
108
95 DEFINE_TRACE(Performance) 109 DEFINE_TRACE(Performance)
96 { 110 {
97 visitor->trace(m_navigation); 111 visitor->trace(m_navigation);
98 visitor->trace(m_timing); 112 visitor->trace(m_timing);
113 visitor->trace(m_longTaskInspectorAgent);
99 DOMWindowProperty::trace(visitor); 114 DOMWindowProperty::trace(visitor);
100 PerformanceBase::trace(visitor); 115 PerformanceBase::trace(visitor);
101 } 116 }
102 117
103 } // namespace blink 118 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/timing/Performance.h ('k') | third_party/WebKit/Source/core/timing/PerformanceBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698