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

Unified Diff: third_party/WebKit/Source/core/paint/PaintTiming.cpp

Issue 2528513003: first-paint and first-contentful paint (Closed)
Patch Set: Got rid of DCHECK cause it breaks unit tests Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/core_idl_files.gni ('k') | third_party/WebKit/Source/core/timing/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintTiming.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintTiming.cpp b/third_party/WebKit/Source/core/paint/PaintTiming.cpp
index 09a950dc37945de3f9bca63eb5b7ab3198a46648..25ef6f7242c62200d277a13a47386855bf43c5d6 100644
--- a/third_party/WebKit/Source/core/paint/PaintTiming.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintTiming.cpp
@@ -6,13 +6,28 @@
#include "core/dom/Document.h"
#include "core/frame/FrameView.h"
+#include "core/frame/LocalDOMWindow.h"
#include "core/frame/LocalFrame.h"
#include "core/loader/DocumentLoader.h"
+#include "core/timing/DOMWindowPerformance.h"
+#include "core/timing/Performance.h"
#include "platform/WebFrameScheduler.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
namespace blink {
+namespace {
+
+Performance* getPerformanceInstance(LocalFrame* frame) {
+ Performance* performance = nullptr;
+ if (frame && frame->domWindow()) {
+ performance = DOMWindowPerformance::performance(*frame->domWindow());
+ }
+ return performance;
+}
+
+} // namespace
+
static const char kSupplementName[] = "PaintTiming";
PaintTiming& PaintTiming::from(Document& document) {
@@ -120,6 +135,10 @@ void PaintTiming::setFirstPaint(double stamp) {
if (m_firstPaint != 0.0)
return;
m_firstPaint = stamp;
+ Performance* performance = getPerformanceInstance(frame());
+ if (performance)
+ performance->addFirstPaintTiming(m_firstPaint);
+
TRACE_EVENT_INSTANT1("blink.user_timing,rail", "firstPaint",
TRACE_EVENT_SCOPE_PROCESS, "frame", frame());
}
@@ -129,6 +148,9 @@ void PaintTiming::setFirstContentfulPaint(double stamp) {
return;
setFirstPaint(stamp);
m_firstContentfulPaint = stamp;
+ Performance* performance = getPerformanceInstance(frame());
+ if (performance)
+ performance->addFirstContentfulPaintTiming(m_firstContentfulPaint);
TRACE_EVENT_INSTANT1("blink.user_timing,rail", "firstContentfulPaint",
TRACE_EVENT_SCOPE_PROCESS, "frame", frame());
}
« no previous file with comments | « third_party/WebKit/Source/core/core_idl_files.gni ('k') | third_party/WebKit/Source/core/timing/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698