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 b5964500258f47b528af52a1acbf486c6e3e5453..34185f974d7d10140a15d5e2dc6cc37ccb2b4230 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintTiming.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintTiming.cpp |
@@ -6,13 +6,29 @@ |
#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/tracing/TraceEvent.h" |
#include "public/platform/WebFrameScheduler.h" |
namespace blink { |
+namespace { |
+ |
+Performance* getPerformanceInstance(LocalFrame* frame) { |
+ Performance* performance = nullptr; |
+ if (frame) { |
+ performance = DOMWindowPerformance::performance(*frame->localDOMWindow()); |
haraken
2016/12/09 00:30:03
frame->localDOMWindow() may return null. Check it.
sunjian
2016/12/09 19:06:49
Done.
|
+ DCHECK(performance); |
+ } |
+ return performance; |
+} |
+ |
+} // namespace |
+ |
static const char kSupplementName[] = "PaintTiming"; |
PaintTiming& PaintTiming::from(Document& document) { |
@@ -122,6 +138,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()); |
} |
@@ -131,6 +151,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()); |
} |