| Index: third_party/WebKit/Source/core/frame/PerformanceMonitor.h
|
| diff --git a/third_party/WebKit/Source/core/frame/PerformanceMonitor.h b/third_party/WebKit/Source/core/frame/PerformanceMonitor.h
|
| index 3fb59dac08b04b748976cf2c95b0c469d750d9a3..872eff9cf2995356c887db8458cec41521d637fa 100644
|
| --- a/third_party/WebKit/Source/core/frame/PerformanceMonitor.h
|
| +++ b/third_party/WebKit/Source/core/frame/PerformanceMonitor.h
|
| @@ -13,10 +13,12 @@
|
| namespace blink {
|
|
|
| class DOMWindow;
|
| +class Document;
|
| class ExecutionContext;
|
| class Frame;
|
| class LocalFrame;
|
| class Performance;
|
| +class SourceLocation;
|
|
|
| // Performance monitor for Web Performance APIs and logging.
|
| // The monitor is maintained per local root.
|
| @@ -29,13 +31,27 @@ class CORE_EXPORT PerformanceMonitor final
|
| WTF_MAKE_NONCOPYABLE(PerformanceMonitor);
|
|
|
| public:
|
| + // Instrumenting methods, TODO: codegen those.
|
| static void performanceObserverAdded(Performance*);
|
| static void performanceObserverRemoved(Performance*);
|
| static void willExecuteScript(ExecutionContext*);
|
| + static void didExecuteScript(ExecutionContext*);
|
| + static void willUpdateLayout(Document*);
|
| + static void didUpdateLayout(Document*);
|
| + static void willRecalculateStyle(Document*);
|
| + static void didRecalculateStyle(Document*);
|
| +
|
| + // Direct logging API for core.
|
| + static void logViolation(ExecutionContext*, const String&);
|
| + static void logViolation(ExecutionContext*,
|
| + const String&,
|
| + std::unique_ptr<SourceLocation>);
|
|
|
| explicit PerformanceMonitor(LocalFrame*);
|
| ~PerformanceMonitor();
|
|
|
| + void setLoggingEnabled(bool);
|
| +
|
| DECLARE_VIRTUAL_TRACE();
|
|
|
| private:
|
| @@ -44,10 +60,17 @@ class CORE_EXPORT PerformanceMonitor final
|
|
|
| static PerformanceMonitor* instrumentingMonitor(ExecutionContext*);
|
|
|
| - void enable();
|
| - void disable();
|
| + void updateInstrumentation();
|
|
|
| void innerWillExecuteScript(ExecutionContext*);
|
| + void didExecuteScript();
|
| + void willUpdateLayout();
|
| + void didUpdateLayout();
|
| + void willRecalculateStyle();
|
| + void didRecalculateStyle();
|
| +
|
| + void logViolation(const String&);
|
| + void logViolation(const String&, std::unique_ptr<SourceLocation>);
|
|
|
| // WebThread::TaskObserver implementation.
|
| void willProcessTask() override;
|
| @@ -63,6 +86,12 @@ class CORE_EXPORT PerformanceMonitor final
|
| Frame* observerFrame);
|
|
|
| bool m_enabled = false;
|
| + bool m_loggingEnabled = false;
|
| + bool m_isExecutingTask = false;
|
| + bool m_isExecutingScript = false;
|
| + double m_layoutStartTime = 0;
|
| + double m_styleStartTime = 0;
|
| + double m_perTaskStyleAndLayoutTime = 0;
|
| Member<LocalFrame> m_localRoot;
|
| HeapHashSet<Member<Frame>> m_frameContexts;
|
| HeapHashSet<Member<Performance>> m_webPerformanceObservers;
|
|
|