Chromium Code Reviews| 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 f87085b838c3eeaf5de00e7bed4e77de66bd05c9..d8310b52a8a6f920d742c05b2371a1a411def9ad 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintTiming.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintTiming.cpp |
| @@ -5,7 +5,11 @@ |
| #include "core/paint/PaintTiming.h" |
| #include "core/dom/Document.h" |
| +#include "core/frame/LocalDOMWindow.h" |
| #include "core/loader/DocumentLoader.h" |
| +#include "core/timing/DOMWindowPerformance.h" |
| +#include "core/timing/Performance.h" |
| +#include "core/timing/PerformancePaintTiming.h" |
|
panicker
2016/12/05 20:51:23
would be nice to avoid this dep directly on Perfor
sunjian
2016/12/07 21:55:43
Done.
|
| #include "platform/tracing/TraceEvent.h" |
| namespace blink { |
| @@ -105,10 +109,24 @@ void PaintTiming::notifyPaintTimingChanged() { |
| m_document->loader()->didChangePerformanceTiming(); |
| } |
| +void PaintTiming::addPaintTimingToPerformance( |
| + PerformancePaintTiming::PaintType type, |
| + double stamp) const { |
| + if (frame()) { |
| + Performance* performance = |
| + DOMWindowPerformance::performance(*frame()->localDOMWindow()); |
| + DCHECK(performance); |
| + performance->addPaintTiming(type, stamp); |
| + } |
| +} |
| + |
| void PaintTiming::setFirstPaint(double stamp) { |
| if (m_firstPaint != 0.0) |
| return; |
| m_firstPaint = stamp; |
| + addPaintTimingToPerformance(PerformancePaintTiming::PaintType::FirstPaint, |
| + m_firstPaint); |
| + |
| TRACE_EVENT_INSTANT1("blink.user_timing,rail", "firstPaint", |
| TRACE_EVENT_SCOPE_PROCESS, "frame", frame()); |
| } |
| @@ -118,6 +136,9 @@ void PaintTiming::setFirstContentfulPaint(double stamp) { |
| return; |
| setFirstPaint(stamp); |
| m_firstContentfulPaint = stamp; |
| + addPaintTimingToPerformance( |
| + PerformancePaintTiming::PaintType::FirstContentfulPaint, |
| + m_firstContentfulPaint); |
| TRACE_EVENT_INSTANT1("blink.user_timing,rail", "firstContentfulPaint", |
| TRACE_EVENT_SCOPE_PROCESS, "frame", frame()); |
| } |