Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: cc/layers/picture_layer.cc

Issue 1075523002: cc: Add UMA stats for record and raster time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use area actually recorded Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/layers/picture_layer.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/metrics/histogram_macros.h"
9 #include "base/timer/elapsed_timer.h"
8 #include "cc/layers/content_layer_client.h" 10 #include "cc/layers/content_layer_client.h"
9 #include "cc/layers/picture_layer_impl.h" 11 #include "cc/layers/picture_layer_impl.h"
10 #include "cc/resources/display_list_recording_source.h" 12 #include "cc/resources/display_list_recording_source.h"
11 #include "cc/resources/picture_pile.h" 13 #include "cc/resources/picture_pile.h"
12 #include "cc/trees/layer_tree_host.h" 14 #include "cc/trees/layer_tree_host.h"
13 #include "cc/trees/layer_tree_impl.h" 15 #include "cc/trees/layer_tree_impl.h"
14 #include "third_party/skia/include/core/SkPictureRecorder.h" 16 #include "third_party/skia/include/core/SkPictureRecorder.h"
15 #include "ui/gfx/geometry/rect_conversions.h" 17 #include "ui/gfx/geometry/rect_conversions.h"
16 18
17 namespace cc { 19 namespace cc {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 131
130 recording_source_->SetBackgroundColor(SafeOpaqueBackgroundColor()); 132 recording_source_->SetBackgroundColor(SafeOpaqueBackgroundColor());
131 recording_source_->SetRequiresClear(!contents_opaque() && 133 recording_source_->SetRequiresClear(!contents_opaque() &&
132 !client_->FillsBoundsCompletely()); 134 !client_->FillsBoundsCompletely());
133 135
134 TRACE_EVENT1("cc", "PictureLayer::Update", 136 TRACE_EVENT1("cc", "PictureLayer::Update",
135 "source_frame_number", 137 "source_frame_number",
136 layer_tree_host()->source_frame_number()); 138 layer_tree_host()->source_frame_number());
137 devtools_instrumentation::ScopedLayerTreeTask update_layer( 139 devtools_instrumentation::ScopedLayerTreeTask update_layer(
138 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id()); 140 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id());
141 base::ElapsedTimer timer;
139 142
140 // Calling paint in WebKit can sometimes cause invalidations, so save 143 // Calling paint in WebKit can sometimes cause invalidations, so save
141 // off the invalidation prior to calling update. 144 // off the invalidation prior to calling update.
142 pending_invalidation_.Swap(&recording_invalidation_); 145 pending_invalidation_.Swap(&recording_invalidation_);
143 pending_invalidation_.Clear(); 146 pending_invalidation_.Clear();
144 147
145 if (layer_tree_host()->settings().record_full_layer) { 148 if (layer_tree_host()->settings().record_full_layer) {
146 // Workaround for http://crbug.com/235910 - to retain backwards compat 149 // Workaround for http://crbug.com/235910 - to retain backwards compat
147 // the full page content must always be provided in the picture layer. 150 // the full page content must always be provided in the picture layer.
148 visible_layer_rect = gfx::Rect(layer_size); 151 visible_layer_rect = gfx::Rect(layer_size);
149 } 152 }
150 153
151 // UpdateAndExpandInvalidation will give us an invalidation that covers 154 // UpdateAndExpandInvalidation will give us an invalidation that covers
152 // anything not explicitly recorded in this frame. We give this region 155 // anything not explicitly recorded in this frame. We give this region
153 // to the impl side so that it drops tiles that may not have a recording 156 // to the impl side so that it drops tiles that may not have a recording
154 // for them. 157 // for them.
158 int recorded_area = 0;
155 DCHECK(client_); 159 DCHECK(client_);
156 updated |= recording_source_->UpdateAndExpandInvalidation( 160 updated |= recording_source_->UpdateAndExpandInvalidation(
157 client_, &recording_invalidation_, layer_size, visible_layer_rect, 161 client_, &recording_invalidation_, layer_size, visible_layer_rect,
158 update_source_frame_number_, RecordingSource::RECORD_NORMALLY); 162 update_source_frame_number_, RecordingSource::RECORD_NORMALLY,
163 &recorded_area);
enne (OOO) 2015/04/09 17:37:34 Yeah, I think this is the right metric. Can you p
jbroman 2015/04/09 20:54:06 Okay, split (with different stat names). This trig
159 last_updated_visible_content_rect_ = visible_content_rect(); 164 last_updated_visible_content_rect_ = visible_content_rect();
160 165
161 if (updated) { 166 if (updated) {
162 SetNeedsPushProperties(); 167 SetNeedsPushProperties();
163 } else { 168 } else {
164 // If this invalidation did not affect the recording source, then it can be 169 // If this invalidation did not affect the recording source, then it can be
165 // cleared as an optimization. 170 // cleared as an optimization.
166 recording_invalidation_.Clear(); 171 recording_invalidation_.Clear();
167 } 172 }
168 173
174 base::TimeDelta elapsed = timer.Elapsed();
175 UMA_HISTOGRAM_COUNTS("Renderer4.PictureLayerUpdateUs",
176 elapsed.InMicroseconds());
177 UMA_HISTOGRAM_COUNTS("Renderer4.PictureLayerUpdatePixelsPerMs",
178 recorded_area / elapsed.InMillisecondsF());
179
169 return updated; 180 return updated;
170 } 181 }
171 182
172 void PictureLayer::SetIsMask(bool is_mask) { 183 void PictureLayer::SetIsMask(bool is_mask) {
173 is_mask_ = is_mask; 184 is_mask_ = is_mask;
174 } 185 }
175 186
176 skia::RefPtr<SkPicture> PictureLayer::GetPicture() const { 187 skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
177 // We could either flatten the RecordingSource into a single SkPicture, 188 // We could either flatten the RecordingSource into a single SkPicture,
178 // or paint a fresh one depending on what we intend to do with the 189 // or paint a fresh one depending on what we intend to do with the
179 // picture. For now we just paint a fresh one to get consistent results. 190 // picture. For now we just paint a fresh one to get consistent results.
180 if (!DrawsContent()) 191 if (!DrawsContent())
181 return skia::RefPtr<SkPicture>(); 192 return skia::RefPtr<SkPicture>();
182 193
183 gfx::Size layer_size = bounds(); 194 gfx::Size layer_size = bounds();
184 const LayerTreeSettings& settings = layer_tree_host()->settings(); 195 const LayerTreeSettings& settings = layer_tree_host()->settings();
185 196
186 if (settings.use_display_lists) { 197 if (settings.use_display_lists) {
187 scoped_ptr<RecordingSource> recording_source; 198 scoped_ptr<RecordingSource> recording_source;
188 recording_source.reset( 199 recording_source.reset(
189 new DisplayListRecordingSource(settings.default_tile_grid_size)); 200 new DisplayListRecordingSource(settings.default_tile_grid_size));
190 Region recording_invalidation; 201 Region recording_invalidation;
191 recording_source->UpdateAndExpandInvalidation( 202 recording_source->UpdateAndExpandInvalidation(
192 client_, &recording_invalidation, layer_size, gfx::Rect(layer_size), 203 client_, &recording_invalidation, layer_size, gfx::Rect(layer_size),
193 update_source_frame_number_, RecordingSource::RECORD_NORMALLY); 204 update_source_frame_number_, RecordingSource::RECORD_NORMALLY, nullptr);
194 205
195 scoped_refptr<RasterSource> raster_source = 206 scoped_refptr<RasterSource> raster_source =
196 recording_source->CreateRasterSource(false); 207 recording_source->CreateRasterSource(false);
197 208
198 return raster_source->GetFlattenedPicture(); 209 return raster_source->GetFlattenedPicture();
199 } 210 }
200 211
201 int width = layer_size.width(); 212 int width = layer_size.width();
202 int height = layer_size.height(); 213 int height = layer_size.height();
203 214
(...skipping 25 matching lines...) Expand all
229 240
230 bool PictureLayer::HasDrawableContent() const { 241 bool PictureLayer::HasDrawableContent() const {
231 return client_ && Layer::HasDrawableContent(); 242 return client_ && Layer::HasDrawableContent();
232 } 243 }
233 244
234 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 245 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
235 benchmark->RunOnLayer(this); 246 benchmark->RunOnLayer(this);
236 } 247 }
237 248
238 } // namespace cc 249 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | cc/resources/recording_source.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698