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