| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/PaintTiming.h" | 5 #include "core/paint/PaintTiming.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/loader/DocumentLoader.h" | 8 #include "core/loader/DocumentLoader.h" |
| 9 #include "platform/TraceEvent.h" | 9 #include "platform/TraceEvent.h" |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void PaintTiming::markFirstImagePaint() | 58 void PaintTiming::markFirstImagePaint() |
| 59 { | 59 { |
| 60 if (m_firstImagePaint != 0.0) | 60 if (m_firstImagePaint != 0.0) |
| 61 return; | 61 return; |
| 62 m_firstImagePaint = monotonicallyIncreasingTime(); | 62 m_firstImagePaint = monotonicallyIncreasingTime(); |
| 63 setFirstContentfulPaint(m_firstImagePaint); | 63 setFirstContentfulPaint(m_firstImagePaint); |
| 64 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "firstImagePaint", m_f
irstImagePaint, "frame", frame()); | 64 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "firstImagePaint", m_f
irstImagePaint, "frame", frame()); |
| 65 notifyPaintTimingChanged(); | 65 notifyPaintTimingChanged(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void PaintTiming::setFirstMeaningfulPaint(double stamp) |
| 69 { |
| 70 DCHECK_EQ(m_firstMeaningfulPaint, 0.0); |
| 71 m_firstMeaningfulPaint = stamp; |
| 72 notifyPaintTimingChanged(); |
| 73 } |
| 74 |
| 68 DEFINE_TRACE(PaintTiming) | 75 DEFINE_TRACE(PaintTiming) |
| 69 { | 76 { |
| 70 visitor->trace(m_document); | 77 visitor->trace(m_document); |
| 78 visitor->trace(m_fmpDetector); |
| 71 Supplement<Document>::trace(visitor); | 79 Supplement<Document>::trace(visitor); |
| 72 } | 80 } |
| 73 | 81 |
| 74 PaintTiming::PaintTiming(Document& document) | 82 PaintTiming::PaintTiming(Document& document) |
| 75 : m_document(document) | 83 : m_document(document) |
| 84 , m_fmpDetector(new FirstMeaningfulPaintDetector(this)) |
| 76 { | 85 { |
| 77 } | 86 } |
| 78 | 87 |
| 79 LocalFrame* PaintTiming::frame() const | 88 LocalFrame* PaintTiming::frame() const |
| 80 { | 89 { |
| 81 return m_document ? m_document->frame() : nullptr; | 90 return m_document ? m_document->frame() : nullptr; |
| 82 } | 91 } |
| 83 | 92 |
| 84 void PaintTiming::notifyPaintTimingChanged() | 93 void PaintTiming::notifyPaintTimingChanged() |
| 85 { | 94 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 98 void PaintTiming::setFirstContentfulPaint(double stamp) | 107 void PaintTiming::setFirstContentfulPaint(double stamp) |
| 99 { | 108 { |
| 100 if (m_firstContentfulPaint != 0.0) | 109 if (m_firstContentfulPaint != 0.0) |
| 101 return; | 110 return; |
| 102 setFirstPaint(stamp); | 111 setFirstPaint(stamp); |
| 103 m_firstContentfulPaint = stamp; | 112 m_firstContentfulPaint = stamp; |
| 104 TRACE_EVENT_INSTANT1("blink.user_timing", "firstContentfulPaint", TRACE_EVEN
T_SCOPE_PROCESS, "frame", frame()); | 113 TRACE_EVENT_INSTANT1("blink.user_timing", "firstContentfulPaint", TRACE_EVEN
T_SCOPE_PROCESS, "frame", frame()); |
| 105 } | 114 } |
| 106 | 115 |
| 107 } // namespace blink | 116 } // namespace blink |
| OLD | NEW |