Chromium Code Reviews| 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]); | 234 scoped_ptr<SkPicture* []> clones(new SkPicture* [num_threads - 1]); |
|
danakj
2014/07/10 19:57:05
This is an array of raw SkRefCnt pointers? Since s
mtklein
2014/07/10 20:09:51
Why don't we rewrite this to just use the other ex
| |
| 235 picture_->clone(&clones[0], num_threads - 1); | 235 picture_->clone(&clones[0], num_threads - 1); |
| 236 | 236 |
| 237 for (int i = 0; i < num_threads - 1; i++) { | 237 for (int i = 0; i < num_threads - 1; i++) { |
| 238 scoped_refptr<Picture> clone = make_scoped_refptr( | 238 scoped_refptr<Picture> clone = make_scoped_refptr(new Picture( |
| 239 new Picture(skia::AdoptRef(new SkPicture(clones[i])), | 239 skia::AdoptRef(clones[i]), layer_rect_, opaque_rect_, pixel_refs_)); |
| 240 layer_rect_, | |
| 241 opaque_rect_, | |
| 242 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 |