Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(821)

Side by Side Diff: cc/test/fake_picture_layer.h

Issue 2451913002: Add serialization/deserialization for FakePictureLayer for testing. (Closed)
Patch Set: Group up overrides in fake_picture_layer.h Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/proto/layer.proto ('k') | cc/test/fake_picture_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15
16 namespace cc { 16 namespace cc {
17 class FakePictureLayer : public PictureLayer { 17 class FakePictureLayer : public PictureLayer {
18 public: 18 public:
19 static scoped_refptr<FakePictureLayer> Create(ContentLayerClient* client) { 19 static scoped_refptr<FakePictureLayer> Create(ContentLayerClient* client) {
20 return make_scoped_refptr(new FakePictureLayer(client)); 20 return make_scoped_refptr(new FakePictureLayer(client));
21 } 21 }
22 22
23 static scoped_refptr<FakePictureLayer> CreateWithRecordingSource( 23 static scoped_refptr<FakePictureLayer> CreateWithRecordingSource(
24 ContentLayerClient* client, 24 ContentLayerClient* client,
25 std::unique_ptr<RecordingSource> source) { 25 std::unique_ptr<RecordingSource> source) {
26 return make_scoped_refptr(new FakePictureLayer(client, std::move(source))); 26 return make_scoped_refptr(new FakePictureLayer(client, std::move(source)));
27 } 27 }
28 28
29 // Layer implementation.
29 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 30 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
31 bool Update() override;
32 bool IsSuitableForGpuRasterization() const override;
30 33
31 int update_count() const { return update_count_; } 34 int update_count() const { return update_count_; }
32 void reset_update_count() { update_count_ = 0; } 35 void reset_update_count() { update_count_ = 0; }
33 36
34 size_t push_properties_count() const { return push_properties_count_; }
35 void reset_push_properties_count() { push_properties_count_ = 0; }
36
37 void set_always_update_resources(bool always_update_resources) { 37 void set_always_update_resources(bool always_update_resources) {
38 always_update_resources_ = always_update_resources; 38 always_update_resources_ = always_update_resources;
39 } 39 }
40 40
41 bool Update() override;
42
43 void PushPropertiesTo(LayerImpl* layer) override;
44
45 void set_recorded_viewport(const gfx::Rect& recorded_viewport) {
46 picture_layer_inputs_.recorded_viewport = recorded_viewport;
47 }
48
49 DisplayItemList* display_list() const {
50 return picture_layer_inputs_.display_list.get();
51 }
52
53 void set_force_unsuitable_for_gpu_rasterization(bool flag) { 41 void set_force_unsuitable_for_gpu_rasterization(bool flag) {
54 force_unsuitable_for_gpu_rasterization_ = flag; 42 force_unsuitable_for_gpu_rasterization_ = flag;
55 } 43 }
56 44
57 bool IsSuitableForGpuRasterization() const override;
58
59 private: 45 private:
60 explicit FakePictureLayer(ContentLayerClient* client); 46 explicit FakePictureLayer(ContentLayerClient* client);
61 FakePictureLayer(ContentLayerClient* client, 47 FakePictureLayer(ContentLayerClient* client,
62 std::unique_ptr<RecordingSource> source); 48 std::unique_ptr<RecordingSource> source);
63 ~FakePictureLayer() override; 49 ~FakePictureLayer() override;
64 50
51 void SetTypeForProtoSerialization(proto::LayerNode* proto) const override;
Khushal 2016/10/26 20:04:55 nit: Shouldn't this be with the other Layer overri
xingliu 2016/10/26 20:13:18 Done. Sorry I missed this one.
52
65 int update_count_; 53 int update_count_;
66 size_t push_properties_count_;
67 bool always_update_resources_; 54 bool always_update_resources_;
68 55
69 bool force_unsuitable_for_gpu_rasterization_; 56 bool force_unsuitable_for_gpu_rasterization_;
70 }; 57 };
71 58
72 } // namespace cc 59 } // namespace cc
73 60
74 #endif // CC_TEST_FAKE_PICTURE_LAYER_H_ 61 #endif // CC_TEST_FAKE_PICTURE_LAYER_H_
OLDNEW
« no previous file with comments | « cc/proto/layer.proto ('k') | cc/test/fake_picture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698