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

Unified Diff: third_party/WebKit/Source/core/frame/PerformanceMonitor.h

Issue 2474073005: DevTools: add the logging aspect into the PerformanceMonitor (Closed)
Patch Set: test fixed Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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..3d6178766484455967d4924588f2b813fc42faf4 100644
--- a/third_party/WebKit/Source/core/frame/PerformanceMonitor.h
+++ b/third_party/WebKit/Source/core/frame/PerformanceMonitor.h
@@ -6,6 +6,7 @@
#define PerformanceMonitor_h
#include "core/CoreExport.h"
+#include "core/inspector/ConsoleTypes.h"
#include "platform/heap/Handle.h"
#include "public/platform/WebThread.h"
#include "public/platform/scheduler/base/task_time_observer.h"
@@ -13,10 +14,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 +32,29 @@ 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 bool enabled(ExecutionContext*);
+ static void logViolation(MessageLevel, ExecutionContext*, const String&);
+ static void logViolation(MessageLevel,
+ ExecutionContext*,
+ const String&,
+ std::unique_ptr<SourceLocation>);
explicit PerformanceMonitor(LocalFrame*);
~PerformanceMonitor();
+ void setLoggingEnabled(bool);
+
DECLARE_VIRTUAL_TRACE();
private:
@@ -44,10 +63,19 @@ 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(MessageLevel, const String&);
+ void logViolation(MessageLevel,
+ const String&,
+ std::unique_ptr<SourceLocation>);
// WebThread::TaskObserver implementation.
void willProcessTask() override;
@@ -63,6 +91,11 @@ class CORE_EXPORT PerformanceMonitor final
Frame* observerFrame);
bool m_enabled = false;
+ bool m_loggingEnabled = 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;
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/frame/PerformanceMonitor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698