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

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: rebase 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
« no previous file with comments | « cc/resources/picture.h ('k') | cc/resources/picture_pile_impl.h » ('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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
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( 228 clone->EmitTraceSnapshot();
229 TRACE_DISABLED_BY_DEFAULT("cc.debug"),
230 "cc::Picture",
231 clone.get(),
232 TracedPicture::AsTraceablePicture(clone.get()));
233 } 229 }
234 } 230 }
235 231
236 void Picture::Record(ContentLayerClient* painter, 232 void Picture::Record(ContentLayerClient* painter,
237 const SkTileGridPicture::TileGridInfo& tile_grid_info, 233 const SkTileGridPicture::TileGridInfo& tile_grid_info,
238 RenderingStats* stats) { 234 RenderingStats* stats) {
239 TRACE_EVENT2("cc", "Picture::Record", 235 TRACE_EVENT2("cc", "Picture::Record",
240 "width", layer_rect_.width(), 236 "width", layer_rect_.width(),
241 "height", layer_rect_.height()); 237 "height", layer_rect_.height());
242 238
(...skipping 26 matching lines...) Expand all
269 stats->total_record_time += base::TimeTicks::Now() - begin_record_time; 265 stats->total_record_time += base::TimeTicks::Now() - begin_record_time;
270 stats->total_pixels_recorded += 266 stats->total_pixels_recorded +=
271 layer_rect_.width() * layer_rect_.height(); 267 layer_rect_.width() * layer_rect_.height();
272 } 268 }
273 269
274 canvas->restore(); 270 canvas->restore();
275 picture_->endRecording(); 271 picture_->endRecording();
276 272
277 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect); 273 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect);
278 274
279 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), 275 EmitTraceSnapshot();
280 "cc::Picture", this, TracedPicture::AsTraceablePicture(this));
281 } 276 }
282 277
283 void Picture::GatherPixelRefs( 278 void Picture::GatherPixelRefs(
284 const SkTileGridPicture::TileGridInfo& tile_grid_info, 279 const SkTileGridPicture::TileGridInfo& tile_grid_info,
285 RenderingStats* stats) { 280 RenderingStats* stats) {
286 TRACE_EVENT2("cc", "Picture::GatherPixelRefs", 281 TRACE_EVENT2("cc", "Picture::GatherPixelRefs",
287 "width", layer_rect_.width(), 282 "width", layer_rect_.width(),
288 "height", layer_rect_.height()); 283 "height", layer_rect_.height());
289 284
290 DCHECK(picture_); 285 DCHECK(picture_);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 size_t serialized_size = stream.bytesWritten(); 379 size_t serialized_size = stream.bytesWritten();
385 scoped_ptr<char[]> serialized_picture(new char[serialized_size]); 380 scoped_ptr<char[]> serialized_picture(new char[serialized_size]);
386 stream.copyTo(serialized_picture.get()); 381 stream.copyTo(serialized_picture.get());
387 std::string b64_picture; 382 std::string b64_picture;
388 base::Base64Encode(std::string(serialized_picture.get(), serialized_size), 383 base::Base64Encode(std::string(serialized_picture.get(), serialized_size),
389 &b64_picture); 384 &b64_picture);
390 res->SetString("skp64", b64_picture); 385 res->SetString("skp64", b64_picture);
391 return res.PassAs<base::Value>(); 386 return res.PassAs<base::Value>();
392 } 387 }
393 388
389 void Picture::EmitTraceSnapshot() {
390 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
391 "cc::Picture", this, TracedPicture::AsTraceablePicture(this));
392 }
393
394 base::LazyInstance<Picture::PixelRefs> 394 base::LazyInstance<Picture::PixelRefs>
395 Picture::PixelRefIterator::empty_pixel_refs_; 395 Picture::PixelRefIterator::empty_pixel_refs_;
396 396
397 Picture::PixelRefIterator::PixelRefIterator() 397 Picture::PixelRefIterator::PixelRefIterator()
398 : picture_(NULL), 398 : picture_(NULL),
399 current_pixel_refs_(empty_pixel_refs_.Pointer()), 399 current_pixel_refs_(empty_pixel_refs_.Pointer()),
400 current_index_(0), 400 current_index_(0),
401 min_point_(-1, -1), 401 min_point_(-1, -1),
402 max_point_(-1, -1), 402 max_point_(-1, -1),
403 current_x_(0), 403 current_x_(0),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 raster_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); 495 raster_data->Set("picture_id", TracedValue::CreateIDRef(this).release());
496 raster_data->SetDouble("scale", scale); 496 raster_data->SetDouble("scale", scale);
497 raster_data->SetDouble("rect_x", rect.x()); 497 raster_data->SetDouble("rect_x", rect.x());
498 raster_data->SetDouble("rect_y", rect.y()); 498 raster_data->SetDouble("rect_y", rect.y());
499 raster_data->SetDouble("rect_width", rect.width()); 499 raster_data->SetDouble("rect_width", rect.width());
500 raster_data->SetDouble("rect_height", rect.height()); 500 raster_data->SetDouble("rect_height", rect.height());
501 return TracedValue::FromValue(raster_data.release()); 501 return TracedValue::FromValue(raster_data.release());
502 } 502 }
503 503
504 } // namespace cc 504 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture.h ('k') | cc/resources/picture_pile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698