OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |