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

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: 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
« no previous file with comments | « no previous file | cc/resources/tile_manager.cc » ('j') | cc/resources/tile_manager.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
(...skipping 10 matching lines...) Expand all
159 last_updated_visible_content_rect_ = visible_content_rect(); 162 last_updated_visible_content_rect_ = visible_content_rect();
160 163
161 if (updated) { 164 if (updated) {
162 SetNeedsPushProperties(); 165 SetNeedsPushProperties();
163 } else { 166 } else {
164 // If this invalidation did not affect the recording source, then it can be 167 // If this invalidation did not affect the recording source, then it can be
165 // cleared as an optimization. 168 // cleared as an optimization.
166 recording_invalidation_.Clear(); 169 recording_invalidation_.Clear();
167 } 170 }
168 171
172 base::TimeDelta elapsed = timer.Elapsed();
173 UMA_HISTOGRAM_COUNTS("Renderer4.PictureLayerUpdateUs",
174 elapsed.InMicroseconds());
175 UMA_HISTOGRAM_COUNTS(
176 "Renderer4.PictureLayerUpdatePixelsPerMs",
177 visible_layer_rect.size().GetArea() / elapsed.InMillisecondsF());
enne (OOO) 2015/04/08 20:18:45 visible layer rect is an inaccurate numerator. Yo
jbroman 2015/04/08 20:37:42 I'm hoping to avoid using an area that has differe
enne (OOO) 2015/04/08 21:03:49 No, the bounds are not the invalidated area. The
178
169 return updated; 179 return updated;
170 } 180 }
171 181
172 void PictureLayer::SetIsMask(bool is_mask) { 182 void PictureLayer::SetIsMask(bool is_mask) {
173 is_mask_ = is_mask; 183 is_mask_ = is_mask;
174 } 184 }
175 185
176 skia::RefPtr<SkPicture> PictureLayer::GetPicture() const { 186 skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
177 // We could either flatten the RecordingSource into a single SkPicture, 187 // 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 188 // or paint a fresh one depending on what we intend to do with the
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 238
229 bool PictureLayer::HasDrawableContent() const { 239 bool PictureLayer::HasDrawableContent() const {
230 return client_ && Layer::HasDrawableContent(); 240 return client_ && Layer::HasDrawableContent();
231 } 241 }
232 242
233 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 243 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
234 benchmark->RunOnLayer(this); 244 benchmark->RunOnLayer(this);
235 } 245 }
236 246
237 } // namespace cc 247 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/tile_manager.cc » ('j') | cc/resources/tile_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698