| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 setFirstContentfulPaint(monotonicallyIncreasingTime()); | 44 setFirstContentfulPaint(monotonicallyIncreasingTime()); |
| 45 notifyPaintTimingChanged(); | 45 notifyPaintTimingChanged(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void PaintTiming::markFirstTextPaint() | 48 void PaintTiming::markFirstTextPaint() |
| 49 { | 49 { |
| 50 if (m_firstTextPaint != 0.0) | 50 if (m_firstTextPaint != 0.0) |
| 51 return; | 51 return; |
| 52 m_firstTextPaint = monotonicallyIncreasingTime(); | 52 m_firstTextPaint = monotonicallyIncreasingTime(); |
| 53 setFirstContentfulPaint(m_firstTextPaint); | 53 setFirstContentfulPaint(m_firstTextPaint); |
| 54 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing,rail", "firstTextPaint",
m_firstTextPaint, "frame", frame()); | 54 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing,rail", "firstTextPaint",
TraceEvent::toTraceTimestamp(m_firstTextPaint), "frame", frame()); |
| 55 notifyPaintTimingChanged(); | 55 notifyPaintTimingChanged(); |
| 56 } | 56 } |
| 57 | 57 |
| 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,rail", "firstImagePaint"
, m_firstImagePaint, "frame", frame()); | 64 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing,rail", "firstImagePaint"
, TraceEvent::toTraceTimestamp(m_firstImagePaint), "frame", frame()); |
| 65 notifyPaintTimingChanged(); | 65 notifyPaintTimingChanged(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void PaintTiming::setFirstMeaningfulPaint(double stamp) | 68 void PaintTiming::setFirstMeaningfulPaint(double stamp) |
| 69 { | 69 { |
| 70 DCHECK_EQ(m_firstMeaningfulPaint, 0.0); | 70 DCHECK_EQ(m_firstMeaningfulPaint, 0.0); |
| 71 m_firstMeaningfulPaint = stamp; | 71 m_firstMeaningfulPaint = stamp; |
| 72 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "firstMeaningfulPaint"
, m_firstMeaningfulPaint, "frame", frame()); | 72 TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "firstMeaningfulPaint"
, TraceEvent::toTraceTimestamp(m_firstMeaningfulPaint), "frame", frame()); |
| 73 notifyPaintTimingChanged(); | 73 notifyPaintTimingChanged(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void PaintTiming::notifyPaint(bool isFirstPaint, bool textPainted, bool imagePai
nted) | 76 void PaintTiming::notifyPaint(bool isFirstPaint, bool textPainted, bool imagePai
nted) |
| 77 { | 77 { |
| 78 if (isFirstPaint) | 78 if (isFirstPaint) |
| 79 markFirstPaint(); | 79 markFirstPaint(); |
| 80 if (textPainted) | 80 if (textPainted) |
| 81 markFirstTextPaint(); | 81 markFirstTextPaint(); |
| 82 if (imagePainted) | 82 if (imagePainted) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void PaintTiming::setFirstContentfulPaint(double stamp) | 119 void PaintTiming::setFirstContentfulPaint(double stamp) |
| 120 { | 120 { |
| 121 if (m_firstContentfulPaint != 0.0) | 121 if (m_firstContentfulPaint != 0.0) |
| 122 return; | 122 return; |
| 123 setFirstPaint(stamp); | 123 setFirstPaint(stamp); |
| 124 m_firstContentfulPaint = stamp; | 124 m_firstContentfulPaint = stamp; |
| 125 TRACE_EVENT_INSTANT1("blink.user_timing,rail", "firstContentfulPaint", TRACE
_EVENT_SCOPE_PROCESS, "frame", frame()); | 125 TRACE_EVENT_INSTANT1("blink.user_timing,rail", "firstContentfulPaint", TRACE
_EVENT_SCOPE_PROCESS, "frame", frame()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace blink | 128 } // namespace blink |
| OLD | NEW |