OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef PerformanceMonitor_h | 5 #ifndef PerformanceMonitor_h |
6 #define PerformanceMonitor_h | 6 #define PerformanceMonitor_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "public/platform/WebThread.h" | 10 #include "public/platform/WebThread.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 ExecutionContext* taskContext, | 62 ExecutionContext* taskContext, |
63 bool hasMultipleContexts){}; | 63 bool hasMultipleContexts){}; |
64 virtual void reportLongLayout(double duration){}; | 64 virtual void reportLongLayout(double duration){}; |
65 virtual void reportGenericViolation(Violation, | 65 virtual void reportGenericViolation(Violation, |
66 const String& text, | 66 const String& text, |
67 double time, | 67 double time, |
68 SourceLocation*){}; | 68 SourceLocation*){}; |
69 DEFINE_INLINE_VIRTUAL_TRACE() {} | 69 DEFINE_INLINE_VIRTUAL_TRACE() {} |
70 }; | 70 }; |
71 | 71 |
72 // Instrumenting methods. | |
73 static void willExecuteScript(ExecutionContext*); | |
74 static void didExecuteScript(ExecutionContext*); | |
75 static void willCallFunction(ExecutionContext*); | |
76 static void didCallFunction(ExecutionContext*, v8::Local<v8::Function>); | |
77 static void willUpdateLayout(Document*); | |
78 static void didUpdateLayout(Document*); | |
79 static void willRecalculateStyle(Document*); | |
80 static void didRecalculateStyle(Document*); | |
81 static void documentWriteFetchScript(Document*); | |
82 static void reportGenericViolation(ExecutionContext*, | 72 static void reportGenericViolation(ExecutionContext*, |
83 Violation, | 73 Violation, |
84 const String& text, | 74 const String& text, |
85 double time, | 75 double time, |
86 std::unique_ptr<SourceLocation>); | 76 std::unique_ptr<SourceLocation>); |
87 static double threshold(ExecutionContext*, Violation); | 77 static double threshold(ExecutionContext*, Violation); |
88 | 78 |
| 79 // Instrumenting methods. |
| 80 void willExecuteScript(ExecutionContext*); |
| 81 void didExecuteScript(); |
| 82 void willCallFunction(ExecutionContext*); |
| 83 void didCallFunction(ExecutionContext*, v8::Local<v8::Function>); |
| 84 void willUpdateLayout(); |
| 85 void didUpdateLayout(); |
| 86 void willRecalculateStyle(Document*); |
| 87 void didRecalculateStyle(); |
| 88 void documentWriteFetchScript(Document*); |
| 89 |
89 // Direct API for core. | 90 // Direct API for core. |
90 void subscribe(Violation, double threshold, Client*); | 91 void subscribe(Violation, double threshold, Client*); |
91 void unsubscribeAll(Client*); | 92 void unsubscribeAll(Client*); |
92 void shutdown(); | 93 void shutdown(); |
93 | 94 |
94 explicit PerformanceMonitor(LocalFrame*); | 95 explicit PerformanceMonitor(LocalFrame*); |
95 ~PerformanceMonitor(); | 96 ~PerformanceMonitor(); |
96 | 97 |
97 DECLARE_VIRTUAL_TRACE(); | 98 DECLARE_VIRTUAL_TRACE(); |
98 | 99 |
99 private: | 100 private: |
100 friend class PerformanceMonitorTest; | 101 friend class PerformanceMonitorTest; |
101 friend class PerformanceTest; | 102 friend class PerformanceTest; |
102 | 103 |
103 static PerformanceMonitor* monitor(const ExecutionContext*); | 104 static PerformanceMonitor* monitor(const ExecutionContext*); |
104 static PerformanceMonitor* instrumentingMonitor(const ExecutionContext*); | 105 static PerformanceMonitor* instrumentingMonitor(const ExecutionContext*); |
105 | 106 |
106 void updateInstrumentation(); | 107 void updateInstrumentation(); |
107 | 108 |
108 void alwaysWillExecuteScript(ExecutionContext*); | |
109 void alwaysDidExecuteScript(); | |
110 void alwaysWillCallFunction(ExecutionContext*); | |
111 void alwaysDidCallFunction(ExecutionContext*, v8::Local<v8::Function>); | |
112 void willUpdateLayout(); | |
113 void didUpdateLayout(); | |
114 void willRecalculateStyle(); | |
115 void didRecalculateStyle(); | |
116 void innerReportGenericViolation(ExecutionContext*, | 109 void innerReportGenericViolation(ExecutionContext*, |
117 Violation, | 110 Violation, |
118 const String& text, | 111 const String& text, |
119 double time, | 112 double time, |
120 std::unique_ptr<SourceLocation>); | 113 std::unique_ptr<SourceLocation>); |
121 | 114 |
122 // scheduler::TaskTimeObserver implementation | 115 // scheduler::TaskTimeObserver implementation |
123 void willProcessTask(scheduler::TaskQueue*, double startTime) override; | 116 void willProcessTask(scheduler::TaskQueue*, double startTime) override; |
124 void didProcessTask(scheduler::TaskQueue*, | 117 void didProcessTask(scheduler::TaskQueue*, |
125 double startTime, | 118 double startTime, |
(...skipping 25 matching lines...) Expand all Loading... |
151 HeapHashMap<Violation, | 144 HeapHashMap<Violation, |
152 Member<ClientThresholds>, | 145 Member<ClientThresholds>, |
153 typename DefaultHash<size_t>::Hash, | 146 typename DefaultHash<size_t>::Hash, |
154 WTF::UnsignedWithZeroKeyHashTraits<size_t>> | 147 WTF::UnsignedWithZeroKeyHashTraits<size_t>> |
155 m_subscriptions; | 148 m_subscriptions; |
156 }; | 149 }; |
157 | 150 |
158 } // namespace blink | 151 } // namespace blink |
159 | 152 |
160 #endif // PerformanceMonitor_h | 153 #endif // PerformanceMonitor_h |
OLD | NEW |