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 #ifndef CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ | 5 #ifndef CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
6 #define CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ | 6 #define CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include <memory> |
| 11 |
| 12 #include "base/memory/ptr_util.h" |
11 #include "cc/layers/picture_layer_impl.h" | 13 #include "cc/layers/picture_layer_impl.h" |
12 #include "cc/playback/raster_source.h" | 14 #include "cc/playback/raster_source.h" |
13 | 15 |
14 namespace cc { | 16 namespace cc { |
15 | 17 |
16 class FakePictureLayerImpl : public PictureLayerImpl { | 18 class FakePictureLayerImpl : public PictureLayerImpl { |
17 public: | 19 public: |
18 static scoped_ptr<FakePictureLayerImpl> Create( | 20 static std::unique_ptr<FakePictureLayerImpl> Create(LayerTreeImpl* tree_impl, |
19 LayerTreeImpl* tree_impl, int id) { | 21 int id) { |
20 bool is_mask = false; | 22 bool is_mask = false; |
21 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, is_mask)); | 23 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, is_mask)); |
22 } | 24 } |
23 | 25 |
24 static scoped_ptr<FakePictureLayerImpl> CreateMask(LayerTreeImpl* tree_impl, | 26 static std::unique_ptr<FakePictureLayerImpl> CreateMask( |
25 int id) { | 27 LayerTreeImpl* tree_impl, |
| 28 int id) { |
26 bool is_mask = true; | 29 bool is_mask = true; |
27 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, is_mask)); | 30 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, is_mask)); |
28 } | 31 } |
29 | 32 |
30 // Create layer from a raster source that covers the entire layer. | 33 // Create layer from a raster source that covers the entire layer. |
31 static scoped_ptr<FakePictureLayerImpl> CreateWithRasterSource( | 34 static std::unique_ptr<FakePictureLayerImpl> CreateWithRasterSource( |
32 LayerTreeImpl* tree_impl, | 35 LayerTreeImpl* tree_impl, |
33 int id, | 36 int id, |
34 scoped_refptr<RasterSource> raster_source) { | 37 scoped_refptr<RasterSource> raster_source) { |
35 bool is_mask = false; | 38 bool is_mask = false; |
36 return make_scoped_ptr( | 39 return base::WrapUnique( |
37 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); | 40 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); |
38 } | 41 } |
39 | 42 |
40 // Create layer from a raster source that only covers part of the layer. | 43 // Create layer from a raster source that only covers part of the layer. |
41 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource( | 44 static std::unique_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource( |
42 LayerTreeImpl* tree_impl, | 45 LayerTreeImpl* tree_impl, |
43 int id, | 46 int id, |
44 scoped_refptr<RasterSource> raster_source, | 47 scoped_refptr<RasterSource> raster_source, |
45 const gfx::Size& layer_bounds) { | 48 const gfx::Size& layer_bounds) { |
46 bool is_mask = false; | 49 bool is_mask = false; |
47 return make_scoped_ptr(new FakePictureLayerImpl( | 50 return base::WrapUnique(new FakePictureLayerImpl( |
48 tree_impl, id, raster_source, is_mask, layer_bounds)); | 51 tree_impl, id, raster_source, is_mask, layer_bounds)); |
49 } | 52 } |
50 | 53 |
51 // Create layer from a raster source that covers the entire layer and is a | 54 // Create layer from a raster source that covers the entire layer and is a |
52 // mask. | 55 // mask. |
53 static scoped_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource( | 56 static std::unique_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource( |
54 LayerTreeImpl* tree_impl, | 57 LayerTreeImpl* tree_impl, |
55 int id, | 58 int id, |
56 scoped_refptr<RasterSource> raster_source) { | 59 scoped_refptr<RasterSource> raster_source) { |
57 bool is_mask = true; | 60 bool is_mask = true; |
58 return make_scoped_ptr( | 61 return base::WrapUnique( |
59 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); | 62 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); |
60 } | 63 } |
61 | 64 |
62 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 65 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
63 void PushPropertiesTo(LayerImpl* layer_impl) override; | 66 void PushPropertiesTo(LayerImpl* layer_impl) override; |
64 void AppendQuads(RenderPass* render_pass, | 67 void AppendQuads(RenderPass* render_pass, |
65 AppendQuadsData* append_quads_data) override; | 68 AppendQuadsData* append_quads_data) override; |
66 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; | 69 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; |
67 | 70 |
68 void DidBecomeActive() override; | 71 void DidBecomeActive() override; |
69 size_t did_become_active_call_count() { | 72 size_t did_become_active_call_count() { |
70 return did_become_active_call_count_; | 73 return did_become_active_call_count_; |
71 } | 74 } |
72 | 75 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 size_t append_quads_count_; | 166 size_t append_quads_count_; |
164 size_t did_become_active_call_count_; | 167 size_t did_become_active_call_count_; |
165 bool has_valid_tile_priorities_; | 168 bool has_valid_tile_priorities_; |
166 bool use_set_valid_tile_priorities_flag_; | 169 bool use_set_valid_tile_priorities_flag_; |
167 size_t release_resources_count_; | 170 size_t release_resources_count_; |
168 }; | 171 }; |
169 | 172 |
170 } // namespace cc | 173 } // namespace cc |
171 | 174 |
172 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ | 175 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |