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

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

Issue 15774010: Add TRACE_EVENT_IS_NEW_TRACE as a way to snapshot objects at start of recording (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: parts for enne Created 7 years, 6 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 | Annotate | Revision Log
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 clones_.clear(); 219 clones_.clear();
220 for (int i = 0; i < num_threads; i++) { 220 for (int i = 0; i < num_threads; i++) {
221 scoped_refptr<Picture> clone = make_scoped_refptr( 221 scoped_refptr<Picture> clone = make_scoped_refptr(
222 new Picture(skia::AdoptRef(new SkPicture(clones[i])), 222 new Picture(skia::AdoptRef(new SkPicture(clones[i])),
223 layer_rect_, 223 layer_rect_,
224 opaque_rect_, 224 opaque_rect_,
225 pixel_refs_)); 225 pixel_refs_));
226 clones_.push_back(clone); 226 clones_.push_back(clone);
227 227
228 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), 228 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
229 "cc::Picture", clone.get(), TracedPicture::AsTraceablePicture(clone)); 229 "cc::Picture", clone.get(), TracedPicture::AsTraceablePicture(clone));
230 } 230 }
231 } 231 }
232 232
233 void Picture::Record(ContentLayerClient* painter, 233 void Picture::Record(ContentLayerClient* painter,
234 const SkTileGridPicture::TileGridInfo& tile_grid_info, 234 const SkTileGridPicture::TileGridInfo& tile_grid_info,
235 RenderingStats* stats) { 235 RenderingStats* stats) {
236 TRACE_EVENT2("cc", "Picture::Record", 236 TRACE_EVENT2("cc", "Picture::Record",
237 "width", layer_rect_.width(), 237 "width", layer_rect_.width(),
238 "height", layer_rect_.height()); 238 "height", layer_rect_.height());
239 239
(...skipping 26 matching lines...) Expand all
266 stats->total_record_time += base::TimeTicks::Now() - begin_record_time; 266 stats->total_record_time += base::TimeTicks::Now() - begin_record_time;
267 stats->total_pixels_recorded += 267 stats->total_pixels_recorded +=
268 layer_rect_.width() * layer_rect_.height(); 268 layer_rect_.width() * layer_rect_.height();
269 } 269 }
270 270
271 canvas->restore(); 271 canvas->restore();
272 picture_->endRecording(); 272 picture_->endRecording();
273 273
274 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect); 274 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect);
275 275
276 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), 276 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
277 "cc::Picture", this, TracedPicture::AsTraceablePicture(this)); 277 "cc::Picture", this, TracedPicture::AsTraceablePicture(this));
278 } 278 }
279 279
280 void Picture::GatherPixelRefs( 280 void Picture::GatherPixelRefs(
281 const SkTileGridPicture::TileGridInfo& tile_grid_info, 281 const SkTileGridPicture::TileGridInfo& tile_grid_info,
282 RenderingStats* stats) { 282 RenderingStats* stats) {
283 TRACE_EVENT2("cc", "Picture::GatherPixelRefs", 283 TRACE_EVENT2("cc", "Picture::GatherPixelRefs",
284 "width", layer_rect_.width(), 284 "width", layer_rect_.width(),
285 "height", layer_rect_.height()); 285 "height", layer_rect_.height());
286 286
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 size_t serialized_size = stream.bytesWritten(); 381 size_t serialized_size = stream.bytesWritten();
382 scoped_ptr<char[]> serialized_picture(new char[serialized_size]); 382 scoped_ptr<char[]> serialized_picture(new char[serialized_size]);
383 stream.copyTo(serialized_picture.get()); 383 stream.copyTo(serialized_picture.get());
384 std::string b64_picture; 384 std::string b64_picture;
385 base::Base64Encode(std::string(serialized_picture.get(), serialized_size), 385 base::Base64Encode(std::string(serialized_picture.get(), serialized_size),
386 &b64_picture); 386 &b64_picture);
387 res->SetString("skp64", b64_picture); 387 res->SetString("skp64", b64_picture);
388 return res.PassAs<base::Value>(); 388 return res.PassAs<base::Value>();
389 } 389 }
390 390
391 void Picture::DidBeginTracing() {
392 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
enne (OOO) 2013/05/31 23:27:21 What about making this Picture::EmitTraceSnapshot
393 "cc::Picture", this, TracedPicture::AsTraceablePicture(this));
394 }
395
391 base::LazyInstance<Picture::PixelRefs> 396 base::LazyInstance<Picture::PixelRefs>
392 Picture::PixelRefIterator::empty_pixel_refs_; 397 Picture::PixelRefIterator::empty_pixel_refs_;
393 398
394 Picture::PixelRefIterator::PixelRefIterator() 399 Picture::PixelRefIterator::PixelRefIterator()
395 : picture_(NULL), 400 : picture_(NULL),
396 current_pixel_refs_(empty_pixel_refs_.Pointer()), 401 current_pixel_refs_(empty_pixel_refs_.Pointer()),
397 current_index_(0), 402 current_index_(0),
398 min_point_(-1, -1), 403 min_point_(-1, -1),
399 max_point_(-1, -1), 404 max_point_(-1, -1),
400 current_x_(0), 405 current_x_(0),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 raster_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); 497 raster_data->Set("picture_id", TracedValue::CreateIDRef(this).release());
493 raster_data->SetDouble("scale", scale); 498 raster_data->SetDouble("scale", scale);
494 raster_data->SetDouble("rect_x", rect.x()); 499 raster_data->SetDouble("rect_x", rect.x());
495 raster_data->SetDouble("rect_y", rect.y()); 500 raster_data->SetDouble("rect_y", rect.y());
496 raster_data->SetDouble("rect_width", rect.width()); 501 raster_data->SetDouble("rect_width", rect.width());
497 raster_data->SetDouble("rect_height", rect.height()); 502 raster_data->SetDouble("rect_height", rect.height());
498 return TracedValue::FromValue(raster_data.release()); 503 return TracedValue::FromValue(raster_data.release());
499 } 504 }
500 505
501 } // namespace cc 506 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698