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 (first_text_paint_ != 0.0) | 65 if (first_text_paint_ != 0.0) |
66 return; | 66 return; |
67 first_text_paint_ = MonotonicallyIncreasingTime(); | 67 first_text_paint_ = MonotonicallyIncreasingTime(); |
68 SetFirstContentfulPaint(first_text_paint_); | 68 SetFirstContentfulPaint(first_text_paint_); |
69 TRACE_EVENT_MARK_WITH_TIMESTAMP1( | 69 TRACE_EVENT_MARK_WITH_TIMESTAMP1( |
70 "rail,devtools.timeline", "firstTextPaint", | 70 "loading,rail,devtools.timeline", "firstTextPaint", |
71 TraceEvent::ToTraceTimestamp(first_text_paint_), "frame", GetFrame()); | 71 TraceEvent::ToTraceTimestamp(first_text_paint_), "frame", GetFrame()); |
72 NotifyPaintTimingChanged(); | 72 NotifyPaintTimingChanged(); |
73 } | 73 } |
74 | 74 |
75 void PaintTiming::MarkFirstImagePaint() { | 75 void PaintTiming::MarkFirstImagePaint() { |
76 if (first_image_paint_ != 0.0) | 76 if (first_image_paint_ != 0.0) |
77 return; | 77 return; |
78 first_image_paint_ = MonotonicallyIncreasingTime(); | 78 first_image_paint_ = MonotonicallyIncreasingTime(); |
79 SetFirstContentfulPaint(first_image_paint_); | 79 SetFirstContentfulPaint(first_image_paint_); |
80 TRACE_EVENT_MARK_WITH_TIMESTAMP1( | 80 TRACE_EVENT_MARK_WITH_TIMESTAMP1( |
81 "rail,devtools.timeline", "firstImagePaint", | 81 "loading,rail,devtools.timeline", "firstImagePaint", |
82 TraceEvent::ToTraceTimestamp(first_image_paint_), "frame", GetFrame()); | 82 TraceEvent::ToTraceTimestamp(first_image_paint_), "frame", GetFrame()); |
83 NotifyPaintTimingChanged(); | 83 NotifyPaintTimingChanged(); |
84 } | 84 } |
85 | 85 |
86 void PaintTiming::SetFirstMeaningfulPaintCandidate(double timestamp) { | 86 void PaintTiming::SetFirstMeaningfulPaintCandidate(double timestamp) { |
87 if (first_meaningful_paint_candidate_) | 87 if (first_meaningful_paint_candidate_) |
88 return; | 88 return; |
89 first_meaningful_paint_candidate_ = timestamp; | 89 first_meaningful_paint_candidate_ = timestamp; |
90 if (GetFrame() && GetFrame()->View() && !GetFrame()->View()->Parent()) { | 90 if (GetFrame() && GetFrame()->View() && !GetFrame()->View()->Parent()) { |
91 GetFrame()->FrameScheduler()->OnFirstMeaningfulPaint(); | 91 GetFrame()->FrameScheduler()->OnFirstMeaningfulPaint(); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 void PaintTiming::SetFirstMeaningfulPaint(double stamp) { | 95 void PaintTiming::SetFirstMeaningfulPaint(double stamp) { |
96 DCHECK_EQ(first_meaningful_paint_, 0.0); | 96 DCHECK_EQ(first_meaningful_paint_, 0.0); |
97 first_meaningful_paint_ = stamp; | 97 first_meaningful_paint_ = stamp; |
98 TRACE_EVENT_MARK_WITH_TIMESTAMP1( | 98 TRACE_EVENT_MARK_WITH_TIMESTAMP1( |
99 "rail,devtools.timeline", "firstMeaningfulPaint", | 99 "loading,rail,devtools.timeline", "firstMeaningfulPaint", |
100 TraceEvent::ToTraceTimestamp(first_meaningful_paint_), "frame", | 100 TraceEvent::ToTraceTimestamp(first_meaningful_paint_), "frame", |
101 GetFrame()); | 101 GetFrame()); |
102 NotifyPaintTimingChanged(); | 102 NotifyPaintTimingChanged(); |
103 } | 103 } |
104 | 104 |
105 void PaintTiming::NotifyPaint(bool is_first_paint, | 105 void PaintTiming::NotifyPaint(bool is_first_paint, |
106 bool text_painted, | 106 bool text_painted, |
107 bool image_painted) { | 107 bool image_painted) { |
108 if (is_first_paint) | 108 if (is_first_paint) |
109 MarkFirstPaint(); | 109 MarkFirstPaint(); |
(...skipping 23 matching lines...) Expand all Loading... |
133 } | 133 } |
134 | 134 |
135 void PaintTiming::SetFirstPaint(double stamp) { | 135 void PaintTiming::SetFirstPaint(double stamp) { |
136 if (first_paint_ != 0.0) | 136 if (first_paint_ != 0.0) |
137 return; | 137 return; |
138 first_paint_ = stamp; | 138 first_paint_ = stamp; |
139 Performance* performance = GetPerformanceInstance(GetFrame()); | 139 Performance* performance = GetPerformanceInstance(GetFrame()); |
140 if (performance) | 140 if (performance) |
141 performance->AddFirstPaintTiming(first_paint_); | 141 performance->AddFirstPaintTiming(first_paint_); |
142 | 142 |
143 TRACE_EVENT_INSTANT1("rail,devtools.timeline", "firstPaint", | 143 TRACE_EVENT_INSTANT1("loading,rail,devtools.timeline", "firstPaint", |
144 TRACE_EVENT_SCOPE_PROCESS, "frame", GetFrame()); | 144 TRACE_EVENT_SCOPE_PROCESS, "frame", GetFrame()); |
145 } | 145 } |
146 | 146 |
147 void PaintTiming::SetFirstContentfulPaint(double stamp) { | 147 void PaintTiming::SetFirstContentfulPaint(double stamp) { |
148 if (first_contentful_paint_ != 0.0) | 148 if (first_contentful_paint_ != 0.0) |
149 return; | 149 return; |
150 SetFirstPaint(stamp); | 150 SetFirstPaint(stamp); |
151 first_contentful_paint_ = stamp; | 151 first_contentful_paint_ = stamp; |
152 Performance* performance = GetPerformanceInstance(GetFrame()); | 152 Performance* performance = GetPerformanceInstance(GetFrame()); |
153 if (performance) | 153 if (performance) |
154 performance->AddFirstContentfulPaintTiming(first_contentful_paint_); | 154 performance->AddFirstContentfulPaintTiming(first_contentful_paint_); |
155 TRACE_EVENT_INSTANT1("rail,devtools.timeline", "firstContentfulPaint", | 155 TRACE_EVENT_INSTANT1("loading,rail,devtools.timeline", "firstContentfulPaint", |
156 TRACE_EVENT_SCOPE_PROCESS, "frame", GetFrame()); | 156 TRACE_EVENT_SCOPE_PROCESS, "frame", GetFrame()); |
157 } | 157 } |
158 | 158 |
159 } // namespace blink | 159 } // namespace blink |
OLD | NEW |