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

Side by Side Diff: cc/resources/picture.cc

Issue 25284005: cc: Add best_record_time to rendering stats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 7 years, 2 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 | « cc/resources/picture.h ('k') | cc/resources/picture_pile.cc » ('j') | no next file with comments »
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/resources/picture.h" 5 #include "cc/resources/picture.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 layer_rect_, 197 layer_rect_,
198 opaque_rect_, 198 opaque_rect_,
199 pixel_refs_)); 199 pixel_refs_));
200 clones_.push_back(clone); 200 clones_.push_back(clone);
201 201
202 clone->EmitTraceSnapshotAlias(this); 202 clone->EmitTraceSnapshotAlias(this);
203 } 203 }
204 } 204 }
205 205
206 void Picture::Record(ContentLayerClient* painter, 206 void Picture::Record(ContentLayerClient* painter,
207 const SkTileGridPicture::TileGridInfo& tile_grid_info, 207 const SkTileGridPicture::TileGridInfo& tile_grid_info) {
208 RenderingStatsInstrumentation* stats_instrumentation) {
209 TRACE_EVENT1(benchmark_instrumentation::kCategory, 208 TRACE_EVENT1(benchmark_instrumentation::kCategory,
210 benchmark_instrumentation::kPictureRecord, 209 benchmark_instrumentation::kPictureRecord,
211 benchmark_instrumentation::kData, AsTraceableRecordData()); 210 benchmark_instrumentation::kData, AsTraceableRecordData());
212 211
213 DCHECK(!tile_grid_info.fTileInterval.isEmpty()); 212 DCHECK(!tile_grid_info.fTileInterval.isEmpty());
214 picture_ = skia::AdoptRef(new SkTileGridPicture( 213 picture_ = skia::AdoptRef(new SkTileGridPicture(
215 layer_rect_.width(), layer_rect_.height(), tile_grid_info)); 214 layer_rect_.width(), layer_rect_.height(), tile_grid_info));
216 215
217 SkCanvas* canvas = picture_->beginRecording( 216 SkCanvas* canvas = picture_->beginRecording(
218 layer_rect_.width(), 217 layer_rect_.width(),
219 layer_rect_.height(), 218 layer_rect_.height(),
220 SkPicture::kUsePathBoundsForClip_RecordingFlag | 219 SkPicture::kUsePathBoundsForClip_RecordingFlag |
221 SkPicture::kOptimizeForClippedPlayback_RecordingFlag); 220 SkPicture::kOptimizeForClippedPlayback_RecordingFlag);
222 221
223 canvas->save(); 222 canvas->save();
224 canvas->translate(SkFloatToScalar(-layer_rect_.x()), 223 canvas->translate(SkFloatToScalar(-layer_rect_.x()),
225 SkFloatToScalar(-layer_rect_.y())); 224 SkFloatToScalar(-layer_rect_.y()));
226 225
227 SkRect layer_skrect = SkRect::MakeXYWH(layer_rect_.x(), 226 SkRect layer_skrect = SkRect::MakeXYWH(layer_rect_.x(),
228 layer_rect_.y(), 227 layer_rect_.y(),
229 layer_rect_.width(), 228 layer_rect_.width(),
230 layer_rect_.height()); 229 layer_rect_.height());
231 canvas->clipRect(layer_skrect); 230 canvas->clipRect(layer_skrect);
232 231
233 gfx::RectF opaque_layer_rect; 232 gfx::RectF opaque_layer_rect;
234 base::TimeTicks start_time = stats_instrumentation->StartRecording();
235 233
236 painter->PaintContents(canvas, layer_rect_, &opaque_layer_rect); 234 painter->PaintContents(canvas, layer_rect_, &opaque_layer_rect);
237 235
238 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time);
239 stats_instrumentation->AddRecord(duration,
240 layer_rect_.width() * layer_rect_.height());
241
242 canvas->restore(); 236 canvas->restore();
243 picture_->endRecording(); 237 picture_->endRecording();
244 238
245 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect); 239 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect);
246 240
247 EmitTraceSnapshot(); 241 EmitTraceSnapshot();
248 } 242 }
249 243
250 void Picture::GatherPixelRefs( 244 void Picture::GatherPixelRefs(
251 const SkTileGridPicture::TileGridInfo& tile_grid_info, 245 const SkTileGridPicture::TileGridInfo& tile_grid_info,
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); 486 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
493 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); 487 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release());
494 record_data->SetInteger(benchmark_instrumentation::kWidth, 488 record_data->SetInteger(benchmark_instrumentation::kWidth,
495 layer_rect_.width()); 489 layer_rect_.width());
496 record_data->SetInteger(benchmark_instrumentation::kHeight, 490 record_data->SetInteger(benchmark_instrumentation::kHeight,
497 layer_rect_.height()); 491 layer_rect_.height());
498 return TracedValue::FromValue(record_data.release()); 492 return TracedValue::FromValue(record_data.release());
499 } 493 }
500 494
501 } // namespace cc 495 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture.h ('k') | cc/resources/picture_pile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698