OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/fake_picture_layer_impl.h" | 5 #include "cc/test/fake_picture_layer_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "cc/test/test_element_id.h" |
12 #include "cc/tiles/tile.h" | 13 #include "cc/tiles/tile.h" |
13 #include "cc/trees/layer_tree_impl.h" | 14 #include "cc/trees/layer_tree_impl.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 FakePictureLayerImpl::FakePictureLayerImpl( | 18 FakePictureLayerImpl::FakePictureLayerImpl( |
18 LayerTreeImpl* tree_impl, | 19 LayerTreeImpl* tree_impl, |
19 int id, | 20 int id, |
20 scoped_refptr<RasterSource> raster_source, | 21 scoped_refptr<RasterSource> raster_source, |
21 bool is_mask) | 22 bool is_mask) |
22 : PictureLayerImpl(tree_impl, id, is_mask), | 23 : PictureLayerImpl(tree_impl, id, is_mask), |
23 append_quads_count_(0), | 24 append_quads_count_(0), |
24 did_become_active_call_count_(0), | 25 did_become_active_call_count_(0), |
25 has_valid_tile_priorities_(false), | 26 has_valid_tile_priorities_(false), |
26 use_set_valid_tile_priorities_flag_(false), | 27 use_set_valid_tile_priorities_flag_(false), |
27 release_resources_count_(0) { | 28 release_resources_count_(0) { |
| 29 SetElementId(NextTestElementId()); |
28 SetBounds(raster_source->GetSize()); | 30 SetBounds(raster_source->GetSize()); |
29 SetRasterSourceOnPending(raster_source, Region()); | 31 SetRasterSourceOnPending(raster_source, Region()); |
30 } | 32 } |
31 | 33 |
32 FakePictureLayerImpl::FakePictureLayerImpl( | 34 FakePictureLayerImpl::FakePictureLayerImpl( |
33 LayerTreeImpl* tree_impl, | 35 LayerTreeImpl* tree_impl, |
34 int id, | 36 int id, |
35 scoped_refptr<RasterSource> raster_source, | 37 scoped_refptr<RasterSource> raster_source, |
36 bool is_mask, | 38 bool is_mask, |
37 const gfx::Size& layer_bounds) | 39 const gfx::Size& layer_bounds) |
38 : PictureLayerImpl(tree_impl, id, is_mask), | 40 : PictureLayerImpl(tree_impl, id, is_mask), |
39 append_quads_count_(0), | 41 append_quads_count_(0), |
40 did_become_active_call_count_(0), | 42 did_become_active_call_count_(0), |
41 has_valid_tile_priorities_(false), | 43 has_valid_tile_priorities_(false), |
42 use_set_valid_tile_priorities_flag_(false), | 44 use_set_valid_tile_priorities_flag_(false), |
43 release_resources_count_(0) { | 45 release_resources_count_(0) { |
| 46 SetElementId(NextTestElementId()); |
44 SetBounds(layer_bounds); | 47 SetBounds(layer_bounds); |
45 SetRasterSourceOnPending(raster_source, Region()); | 48 SetRasterSourceOnPending(raster_source, Region()); |
46 } | 49 } |
47 | 50 |
48 FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl, | 51 FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
49 int id, | 52 int id, |
50 bool is_mask) | 53 bool is_mask) |
51 : PictureLayerImpl(tree_impl, id, is_mask), | 54 : PictureLayerImpl(tree_impl, id, is_mask), |
52 append_quads_count_(0), | 55 append_quads_count_(0), |
53 did_become_active_call_count_(0), | 56 did_become_active_call_count_(0), |
54 has_valid_tile_priorities_(false), | 57 has_valid_tile_priorities_(false), |
55 use_set_valid_tile_priorities_flag_(false), | 58 use_set_valid_tile_priorities_flag_(false), |
56 release_resources_count_(0) {} | 59 release_resources_count_(0) { |
| 60 SetElementId(NextTestElementId()); |
| 61 } |
57 | 62 |
58 std::unique_ptr<LayerImpl> FakePictureLayerImpl::CreateLayerImpl( | 63 std::unique_ptr<LayerImpl> FakePictureLayerImpl::CreateLayerImpl( |
59 LayerTreeImpl* tree_impl) { | 64 LayerTreeImpl* tree_impl) { |
60 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id(), is_mask_)); | 65 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id(), is_mask_)); |
61 } | 66 } |
62 | 67 |
63 void FakePictureLayerImpl::PushPropertiesTo(LayerImpl* layer_impl) { | 68 void FakePictureLayerImpl::PushPropertiesTo(LayerImpl* layer_impl) { |
64 FakePictureLayerImpl* picture_layer_impl = | 69 FakePictureLayerImpl* picture_layer_impl = |
65 static_cast<FakePictureLayerImpl*>(layer_impl); | 70 static_cast<FakePictureLayerImpl*>(layer_impl); |
66 picture_layer_impl->fixed_tile_size_ = fixed_tile_size_; | 71 picture_layer_impl->fixed_tile_size_ = fixed_tile_size_; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 219 |
215 return CountTilesRequired(&PictureLayerTiling::IsTileRequiredForDraw); | 220 return CountTilesRequired(&PictureLayerTiling::IsTileRequiredForDraw); |
216 } | 221 } |
217 | 222 |
218 void FakePictureLayerImpl::ReleaseResources() { | 223 void FakePictureLayerImpl::ReleaseResources() { |
219 PictureLayerImpl::ReleaseResources(); | 224 PictureLayerImpl::ReleaseResources(); |
220 ++release_resources_count_; | 225 ++release_resources_count_; |
221 } | 226 } |
222 | 227 |
223 } // namespace cc | 228 } // namespace cc |
OLD | NEW |