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 #ifndef CC_TEST_FAKE_PICTURE_LAYER_H_ | 5 #ifndef CC_TEST_FAKE_PICTURE_LAYER_H_ |
6 #define CC_TEST_FAKE_PICTURE_LAYER_H_ | 6 #define CC_TEST_FAKE_PICTURE_LAYER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "cc/layers/picture_layer.h" | 13 #include "cc/layers/picture_layer.h" |
13 #include "cc/playback/recording_source.h" | 14 #include "cc/playback/recording_source.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 class FakePictureLayer : public PictureLayer { | 17 class FakePictureLayer : public PictureLayer { |
17 public: | 18 public: |
18 static scoped_refptr<FakePictureLayer> Create(ContentLayerClient* client) { | 19 static scoped_refptr<FakePictureLayer> Create(ContentLayerClient* client) { |
19 return make_scoped_refptr(new FakePictureLayer(client)); | 20 return make_scoped_refptr(new FakePictureLayer(client)); |
20 } | 21 } |
21 | 22 |
22 static scoped_refptr<FakePictureLayer> CreateWithRecordingSource( | 23 static scoped_refptr<FakePictureLayer> CreateWithRecordingSource( |
23 ContentLayerClient* client, | 24 ContentLayerClient* client, |
24 scoped_ptr<RecordingSource> source) { | 25 std::unique_ptr<RecordingSource> source) { |
25 return make_scoped_refptr(new FakePictureLayer(client, std::move(source))); | 26 return make_scoped_refptr(new FakePictureLayer(client, std::move(source))); |
26 } | 27 } |
27 | 28 |
28 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 29 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
29 | 30 |
30 int update_count() const { return update_count_; } | 31 int update_count() const { return update_count_; } |
31 void reset_update_count() { update_count_ = 0; } | 32 void reset_update_count() { update_count_ = 0; } |
32 | 33 |
33 size_t push_properties_count() const { return push_properties_count_; } | 34 size_t push_properties_count() const { return push_properties_count_; } |
34 void reset_push_properties_count() { push_properties_count_ = 0; } | 35 void reset_push_properties_count() { push_properties_count_ = 0; } |
35 | 36 |
36 void set_always_update_resources(bool always_update_resources) { | 37 void set_always_update_resources(bool always_update_resources) { |
37 always_update_resources_ = always_update_resources; | 38 always_update_resources_ = always_update_resources; |
38 } | 39 } |
39 | 40 |
40 bool Update() override; | 41 bool Update() override; |
41 | 42 |
42 void PushPropertiesTo(LayerImpl* layer) override; | 43 void PushPropertiesTo(LayerImpl* layer) override; |
43 | 44 |
44 private: | 45 private: |
45 explicit FakePictureLayer(ContentLayerClient* client); | 46 explicit FakePictureLayer(ContentLayerClient* client); |
46 FakePictureLayer(ContentLayerClient* client, | 47 FakePictureLayer(ContentLayerClient* client, |
47 scoped_ptr<RecordingSource> source); | 48 std::unique_ptr<RecordingSource> source); |
48 ~FakePictureLayer() override; | 49 ~FakePictureLayer() override; |
49 | 50 |
50 int update_count_; | 51 int update_count_; |
51 size_t push_properties_count_; | 52 size_t push_properties_count_; |
52 bool always_update_resources_; | 53 bool always_update_resources_; |
53 }; | 54 }; |
54 | 55 |
55 } // namespace cc | 56 } // namespace cc |
56 | 57 |
57 #endif // CC_TEST_FAKE_PICTURE_LAYER_H_ | 58 #endif // CC_TEST_FAKE_PICTURE_LAYER_H_ |
OLD | NEW |