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> | 10 #include <memory> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "cc/layers/picture_layer.h" | 13 #include "cc/layers/picture_layer.h" |
14 #include "cc/playback/recording_source.h" | 14 #include "cc/playback/recording_source.h" |
| 15 #include "cc/test/test_element_id.h" |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 class FakePictureLayer : public PictureLayer { | 18 class FakePictureLayer : public PictureLayer { |
18 public: | 19 public: |
19 static scoped_refptr<FakePictureLayer> Create(ContentLayerClient* client) { | 20 static scoped_refptr<FakePictureLayer> Create(ContentLayerClient* client) { |
20 return make_scoped_refptr(new FakePictureLayer(client)); | 21 auto layer = make_scoped_refptr(new FakePictureLayer(client)); |
| 22 layer->SetElementId(NextTestElementId()); |
| 23 return layer; |
21 } | 24 } |
22 | 25 |
23 static scoped_refptr<FakePictureLayer> CreateWithRecordingSource( | 26 static scoped_refptr<FakePictureLayer> CreateWithRecordingSource( |
24 ContentLayerClient* client, | 27 ContentLayerClient* client, |
25 std::unique_ptr<RecordingSource> source) { | 28 std::unique_ptr<RecordingSource> source) { |
26 return make_scoped_refptr(new FakePictureLayer(client, std::move(source))); | 29 auto layer = |
| 30 make_scoped_refptr(new FakePictureLayer(client, std::move(source))); |
| 31 layer->SetElementId(NextTestElementId()); |
| 32 return layer; |
27 } | 33 } |
28 | 34 |
29 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 35 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
30 | 36 |
31 int update_count() const { return update_count_; } | 37 int update_count() const { return update_count_; } |
32 void reset_update_count() { update_count_ = 0; } | 38 void reset_update_count() { update_count_ = 0; } |
33 | 39 |
34 size_t push_properties_count() const { return push_properties_count_; } | 40 size_t push_properties_count() const { return push_properties_count_; } |
35 void reset_push_properties_count() { push_properties_count_ = 0; } | 41 void reset_push_properties_count() { push_properties_count_ = 0; } |
36 | 42 |
(...skipping 12 matching lines...) Expand all Loading... |
49 ~FakePictureLayer() override; | 55 ~FakePictureLayer() override; |
50 | 56 |
51 int update_count_; | 57 int update_count_; |
52 size_t push_properties_count_; | 58 size_t push_properties_count_; |
53 bool always_update_resources_; | 59 bool always_update_resources_; |
54 }; | 60 }; |
55 | 61 |
56 } // namespace cc | 62 } // namespace cc |
57 | 63 |
58 #endif // CC_TEST_FAKE_PICTURE_LAYER_H_ | 64 #endif // CC_TEST_FAKE_PICTURE_LAYER_H_ |
OLD | NEW |