OLD | NEW |
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 18 matching lines...) Expand all Loading... |
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" | 36 #include "core/inspector/InspectedFrames.h" |
37 #include "core/inspector/InspectorWebPerfAgent.h" | 37 #include "core/inspector/InspectorWebPerfAgent.h" |
38 #include "core/loader/DocumentLoader.h" | 38 #include "core/loader/DocumentLoader.h" |
| 39 #include "core/origin_trials/OriginTrials.h" |
39 #include "core/timing/PerformanceTiming.h" | 40 #include "core/timing/PerformanceTiming.h" |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 static double toTimeOrigin(LocalFrame* frame) | 44 static double toTimeOrigin(LocalFrame* frame) |
44 { | 45 { |
45 if (!frame) | 46 if (!frame) |
46 return 0.0; | 47 return 0.0; |
47 | 48 |
48 Document* document = frame->document(); | 49 Document* document = frame->document(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 { | 91 { |
91 if (!m_timing) | 92 if (!m_timing) |
92 m_timing = PerformanceTiming::create(frame()); | 93 m_timing = PerformanceTiming::create(frame()); |
93 | 94 |
94 return m_timing.get(); | 95 return m_timing.get(); |
95 } | 96 } |
96 | 97 |
97 void Performance::updateLongTaskInstrumentation() | 98 void Performance::updateLongTaskInstrumentation() |
98 { | 99 { |
99 if (hasObserverFor(PerformanceEntry::LongTask) && !m_longTaskInspectorAgent)
{ | 100 if (hasObserverFor(PerformanceEntry::LongTask) && !m_longTaskInspectorAgent)
{ |
| 101 if (!frame() || !frame()->document() |
| 102 || !OriginTrials::longTaskObserverEnabled(frame()->document())) |
| 103 return; |
100 m_longTaskInspectorAgent = new InspectorWebPerfAgent( | 104 m_longTaskInspectorAgent = new InspectorWebPerfAgent( |
101 InspectedFrames::create(frame())); | 105 InspectedFrames::create(frame())); |
102 m_longTaskInspectorAgent->enable(); | 106 m_longTaskInspectorAgent->enable(); |
103 } else if (!hasObserverFor(PerformanceEntry::LongTask) && m_longTaskInspecto
rAgent) { | 107 } else if (!hasObserverFor(PerformanceEntry::LongTask) && m_longTaskInspecto
rAgent) { |
104 m_longTaskInspectorAgent->disable(); | 108 m_longTaskInspectorAgent->disable(); |
105 m_longTaskInspectorAgent = nullptr; | 109 m_longTaskInspectorAgent = nullptr; |
106 } | 110 } |
107 } | 111 } |
108 | 112 |
109 DEFINE_TRACE(Performance) | 113 DEFINE_TRACE(Performance) |
110 { | 114 { |
111 visitor->trace(m_navigation); | 115 visitor->trace(m_navigation); |
112 visitor->trace(m_timing); | 116 visitor->trace(m_timing); |
113 visitor->trace(m_longTaskInspectorAgent); | 117 visitor->trace(m_longTaskInspectorAgent); |
114 DOMWindowProperty::trace(visitor); | 118 DOMWindowProperty::trace(visitor); |
115 PerformanceBase::trace(visitor); | 119 PerformanceBase::trace(visitor); |
116 } | 120 } |
117 | 121 |
118 } // namespace blink | 122 } // namespace blink |
OLD | NEW |