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/tiles/picture_layer_tiling_set.h" | 5 #include "cc/tiles/picture_layer_tiling_set.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 float contents_scale, | 264 float contents_scale, |
265 scoped_refptr<RasterSource> raster_source) { | 265 scoped_refptr<RasterSource> raster_source) { |
266 if (!raster_source_) | 266 if (!raster_source_) |
267 raster_source_ = raster_source; | 267 raster_source_ = raster_source; |
268 | 268 |
269 for (size_t i = 0; i < tilings_.size(); ++i) { | 269 for (size_t i = 0; i < tilings_.size(); ++i) { |
270 DCHECK_NE(tilings_[i]->contents_scale(), contents_scale); | 270 DCHECK_NE(tilings_[i]->contents_scale(), contents_scale); |
271 DCHECK_EQ(tilings_[i]->raster_source(), raster_source.get()); | 271 DCHECK_EQ(tilings_[i]->raster_source(), raster_source.get()); |
272 } | 272 } |
273 | 273 |
274 tilings_.push_back(base::WrapUnique( | 274 tilings_.push_back(base::MakeUnique<PictureLayerTiling>( |
275 new PictureLayerTiling(tree_, contents_scale, raster_source, client_))); | 275 tree_, contents_scale, raster_source, client_)); |
276 PictureLayerTiling* appended = tilings_.back().get(); | 276 PictureLayerTiling* appended = tilings_.back().get(); |
277 state_since_last_tile_priority_update_.added_tilings = true; | 277 state_since_last_tile_priority_update_.added_tilings = true; |
278 | 278 |
279 std::sort(tilings_.begin(), tilings_.end(), LargestToSmallestScaleFunctor()); | 279 std::sort(tilings_.begin(), tilings_.end(), LargestToSmallestScaleFunctor()); |
280 return appended; | 280 return appended; |
281 } | 281 } |
282 | 282 |
283 int PictureLayerTilingSet::NumHighResTilings() const { | 283 int PictureLayerTilingSet::NumHighResTilings() const { |
284 return std::count_if(tilings_.begin(), tilings_.end(), | 284 return std::count_if(tilings_.begin(), tilings_.end(), |
285 [](const std::unique_ptr<PictureLayerTiling>& tiling) { | 285 [](const std::unique_ptr<PictureLayerTiling>& tiling) { |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 case LOWER_THAN_LOW_RES: | 748 case LOWER_THAN_LOW_RES: |
749 range = TilingRange(low_res_range.end, tilings_size); | 749 range = TilingRange(low_res_range.end, tilings_size); |
750 break; | 750 break; |
751 } | 751 } |
752 | 752 |
753 DCHECK_LE(range.start, range.end); | 753 DCHECK_LE(range.start, range.end); |
754 return range; | 754 return range; |
755 } | 755 } |
756 | 756 |
757 } // namespace cc | 757 } // namespace cc |
OLD | NEW |