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

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

Issue 380323002: Switch to one-at-a-time SkPicture::clone interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch to using single clone entry point Created 6 years, 5 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 | « no previous file | no next file » | 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return; 224 return;
225 } 225 }
226 226
227 DCHECK(picture_); 227 DCHECK(picture_);
228 DCHECK(clones_.empty()); 228 DCHECK(clones_.empty());
229 229
230 // We can re-use this picture for one raster worker thread. 230 // We can re-use this picture for one raster worker thread.
231 raster_thread_checker_.DetachFromThread(); 231 raster_thread_checker_.DetachFromThread();
232 232
233 if (num_threads > 1) { 233 if (num_threads > 1) {
234 scoped_ptr<SkPicture[]> clones(new SkPicture[num_threads - 1]);
235 picture_->clone(&clones[0], num_threads - 1);
236
237 for (int i = 0; i < num_threads - 1; i++) { 234 for (int i = 0; i < num_threads - 1; i++) {
238 scoped_refptr<Picture> clone = make_scoped_refptr( 235 scoped_refptr<Picture> clone =
239 new Picture(skia::AdoptRef(new SkPicture(clones[i])), 236 make_scoped_refptr(new Picture(skia::AdoptRef(picture_->clone()),
danakj 2014/07/11 15:30:40 nit: FWIW make_scoped_refptr is redundant, that co
robertphillips 2014/07/11 15:59:42 Done.
240 layer_rect_, 237 layer_rect_,
241 opaque_rect_, 238 opaque_rect_,
242 pixel_refs_)); 239 pixel_refs_));
243 clones_.push_back(clone); 240 clones_.push_back(clone);
244 241
245 clone->EmitTraceSnapshotAlias(this); 242 clone->EmitTraceSnapshotAlias(this);
246 clone->raster_thread_checker_.DetachFromThread(); 243 clone->raster_thread_checker_.DetachFromThread();
247 } 244 }
248 } 245 }
249 } 246 }
250 247
251 void Picture::Record(ContentLayerClient* painter, 248 void Picture::Record(ContentLayerClient* painter,
252 const SkTileGridFactory::TileGridInfo& tile_grid_info, 249 const SkTileGridFactory::TileGridInfo& tile_grid_info,
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 594
598 scoped_refptr<base::debug::ConvertableToTraceFormat> 595 scoped_refptr<base::debug::ConvertableToTraceFormat>
599 Picture::AsTraceableRecordData() const { 596 Picture::AsTraceableRecordData() const {
600 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); 597 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue());
601 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release()); 598 record_data->Set("picture_id", TracedValue::CreateIDRef(this).release());
602 record_data->Set("layer_rect", MathUtil::AsValue(layer_rect_).release()); 599 record_data->Set("layer_rect", MathUtil::AsValue(layer_rect_).release());
603 return TracedValue::FromValue(record_data.release()); 600 return TracedValue::FromValue(record_data.release());
604 } 601 }
605 602
606 } // namespace cc 603 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698