Chromium Code Reviews| 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/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 setFirstContentfulPaint(monotonicallyIncreasingTime()); | 60 setFirstContentfulPaint(monotonicallyIncreasingTime()); |
| 61 notifyPaintTimingChanged(); | 61 notifyPaintTimingChanged(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void PaintTiming::markFirstTextPaint() { | 64 void PaintTiming::markFirstTextPaint() { |
| 65 if (m_firstTextPaint != 0.0) | 65 if (m_firstTextPaint != 0.0) |
| 66 return; | 66 return; |
| 67 m_firstTextPaint = monotonicallyIncreasingTime(); | 67 m_firstTextPaint = monotonicallyIncreasingTime(); |
| 68 setFirstContentfulPaint(m_firstTextPaint); | 68 setFirstContentfulPaint(m_firstTextPaint); |
| 69 TRACE_EVENT_MARK_WITH_TIMESTAMP1( | 69 TRACE_EVENT_MARK_WITH_TIMESTAMP1( |
| 70 "blink.user_timing,rail", "firstTextPaint", | 70 "rail,devtools.timeline", "firstTextPaint", |
| 71 TraceEvent::toTraceTimestamp(m_firstTextPaint), "frame", frame()); | 71 TraceEvent::toTraceTimestamp(m_firstTextPaint), "frame", frame()); |
| 72 notifyPaintTimingChanged(); | 72 notifyPaintTimingChanged(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void PaintTiming::markFirstImagePaint() { | 75 void PaintTiming::markFirstImagePaint() { |
| 76 if (m_firstImagePaint != 0.0) | 76 if (m_firstImagePaint != 0.0) |
| 77 return; | 77 return; |
| 78 m_firstImagePaint = monotonicallyIncreasingTime(); | 78 m_firstImagePaint = monotonicallyIncreasingTime(); |
| 79 setFirstContentfulPaint(m_firstImagePaint); | 79 setFirstContentfulPaint(m_firstImagePaint); |
| 80 TRACE_EVENT_MARK_WITH_TIMESTAMP1( | 80 TRACE_EVENT_MARK_WITH_TIMESTAMP1( |
| 81 "blink.user_timing,rail", "firstImagePaint", | 81 "rail,devtools.timeline", "firstImagePaint", |
| 82 TraceEvent::toTraceTimestamp(m_firstImagePaint), "frame", frame()); | 82 TraceEvent::toTraceTimestamp(m_firstImagePaint), "frame", frame()); |
| 83 notifyPaintTimingChanged(); | 83 notifyPaintTimingChanged(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void PaintTiming::setFirstMeaningfulPaintCandidate(double timestamp) { | 86 void PaintTiming::setFirstMeaningfulPaintCandidate(double timestamp) { |
| 87 if (m_firstMeaningfulPaintCandidate) | 87 if (m_firstMeaningfulPaintCandidate) |
| 88 return; | 88 return; |
| 89 m_firstMeaningfulPaintCandidate = timestamp; | 89 m_firstMeaningfulPaintCandidate = timestamp; |
| 90 if (frame() && frame()->view() && !frame()->view()->parent()) { | 90 if (frame() && frame()->view() && !frame()->view()->parent()) { |
| 91 frame()->frameScheduler()->onFirstMeaningfulPaint(); | 91 frame()->frameScheduler()->onFirstMeaningfulPaint(); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 void PaintTiming::setFirstMeaningfulPaint(double stamp) { | 95 void PaintTiming::setFirstMeaningfulPaint(double stamp) { |
| 96 DCHECK_EQ(m_firstMeaningfulPaint, 0.0); | 96 DCHECK_EQ(m_firstMeaningfulPaint, 0.0); |
| 97 m_firstMeaningfulPaint = stamp; | 97 m_firstMeaningfulPaint = stamp; |
| 98 TRACE_EVENT_MARK_WITH_TIMESTAMP1( | 98 TRACE_EVENT_MARK_WITH_TIMESTAMP1( |
| 99 "blink.user_timing", "firstMeaningfulPaint", | 99 "rail,devtools.timeline", "firstMeaningfulPaint", |
| 100 TraceEvent::toTraceTimestamp(m_firstMeaningfulPaint), "frame", frame()); | 100 TraceEvent::toTraceTimestamp(m_firstMeaningfulPaint), "frame", frame()); |
| 101 notifyPaintTimingChanged(); | 101 notifyPaintTimingChanged(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void PaintTiming::notifyPaint(bool isFirstPaint, | 104 void PaintTiming::notifyPaint(bool isFirstPaint, |
| 105 bool textPainted, | 105 bool textPainted, |
| 106 bool imagePainted) { | 106 bool imagePainted) { |
| 107 if (isFirstPaint) | 107 if (isFirstPaint) |
| 108 markFirstPaint(); | 108 markFirstPaint(); |
| 109 if (textPainted) | 109 if (textPainted) |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 132 } | 132 } |
| 133 | 133 |
| 134 void PaintTiming::setFirstPaint(double stamp) { | 134 void PaintTiming::setFirstPaint(double stamp) { |
| 135 if (m_firstPaint != 0.0) | 135 if (m_firstPaint != 0.0) |
| 136 return; | 136 return; |
| 137 m_firstPaint = stamp; | 137 m_firstPaint = stamp; |
| 138 Performance* performance = getPerformanceInstance(frame()); | 138 Performance* performance = getPerformanceInstance(frame()); |
| 139 if (performance) | 139 if (performance) |
| 140 performance->addFirstPaintTiming(m_firstPaint); | 140 performance->addFirstPaintTiming(m_firstPaint); |
| 141 | 141 |
| 142 TRACE_EVENT_INSTANT1("blink.user_timing,rail", "firstPaint", | 142 TRACE_EVENT_INSTANT1("rail,devtools.timeline", "firstPaint", |
| 143 TRACE_EVENT_SCOPE_PROCESS, "frame", frame()); | 143 TRACE_EVENT_SCOPE_PROCESS, "frame", frame()); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void PaintTiming::setFirstContentfulPaint(double stamp) { | 146 void PaintTiming::setFirstContentfulPaint(double stamp) { |
| 147 if (m_firstContentfulPaint != 0.0) | 147 if (m_firstContentfulPaint != 0.0) |
| 148 return; | 148 return; |
| 149 setFirstPaint(stamp); | 149 setFirstPaint(stamp); |
| 150 m_firstContentfulPaint = stamp; | 150 m_firstContentfulPaint = stamp; |
| 151 Performance* performance = getPerformanceInstance(frame()); | 151 Performance* performance = getPerformanceInstance(frame()); |
| 152 if (performance) | 152 if (performance) |
| 153 performance->addFirstContentfulPaintTiming(m_firstContentfulPaint); | 153 performance->addFirstContentfulPaintTiming(m_firstContentfulPaint); |
| 154 TRACE_EVENT_INSTANT1("blink.user_timing,rail", "firstContentfulPaint", | 154 TRACE_EVENT_INSTANT1("rail,devtools.timeline", "firstContentfulPaint", |
|
pfeldman
2017/04/07 19:02:33
I only found this one mentioned in catapult, but I
| |
| 155 TRACE_EVENT_SCOPE_PROCESS, "frame", frame()); | 155 TRACE_EVENT_SCOPE_PROCESS, "frame", frame()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace blink | 158 } // namespace blink |
| OLD | NEW |