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

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

Issue 640063010: cc: Don't swap PictureLayerTilingSet on activate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: noswap: reviewround1 Created 6 years 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
OLDNEW
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 "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/layers/picture_layer_impl.h" 9 #include "cc/layers/picture_layer_impl.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 class FakePictureLayerImpl : public PictureLayerImpl { 13 class FakePictureLayerImpl : public PictureLayerImpl {
14 public: 14 public:
15 static scoped_ptr<FakePictureLayerImpl> Create( 15 static scoped_ptr<FakePictureLayerImpl> Create(
16 LayerTreeImpl* tree_impl, int id) { 16 LayerTreeImpl* tree_impl, int id) {
17 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id)); 17 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id));
18 } 18 }
19 19
20 // Create layer from a raster source that covers the entire layer. 20 // Create layer from a raster source that covers the entire layer.
21 static scoped_ptr<FakePictureLayerImpl> CreateWithRasterSource( 21 static scoped_ptr<FakePictureLayerImpl> CreateWithRasterSource(
22 LayerTreeImpl* tree_impl, 22 LayerTreeImpl* tree_impl,
23 int id, 23 int id,
24 scoped_refptr<RasterSource> raster_source) { 24 scoped_refptr<RasterSource> raster_source) {
25 bool is_mask = false;
25 return make_scoped_ptr( 26 return make_scoped_ptr(
26 new FakePictureLayerImpl(tree_impl, id, raster_source)); 27 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask));
27 } 28 }
28 29
29 // Create layer from a raster source that only covers part of the layer. 30 // Create layer from a raster source that only covers part of the layer.
30 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource( 31 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource(
31 LayerTreeImpl* tree_impl, 32 LayerTreeImpl* tree_impl,
32 int id, 33 int id,
33 scoped_refptr<RasterSource> raster_source, 34 scoped_refptr<RasterSource> raster_source,
34 const gfx::Size& layer_bounds) { 35 const gfx::Size& layer_bounds) {
36 bool is_mask = false;
37 return make_scoped_ptr(new FakePictureLayerImpl(
38 tree_impl, id, raster_source, is_mask, layer_bounds));
39 }
40
41 // Create layer from a raster source that covers the entire layer and is a
42 // mask.
43 static scoped_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource(
44 LayerTreeImpl* tree_impl,
45 int id,
46 scoped_refptr<RasterSource> raster_source) {
47 bool is_mask = true;
35 return make_scoped_ptr( 48 return make_scoped_ptr(
36 new FakePictureLayerImpl(tree_impl, id, raster_source, layer_bounds)); 49 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask));
37 } 50 }
38 51
39 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 52 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
53 void PushPropertiesTo(LayerImpl* layer_impl) override;
40 void AppendQuads(RenderPass* render_pass, 54 void AppendQuads(RenderPass* render_pass,
41 const Occlusion& occlusion_in_content_space, 55 const Occlusion& occlusion_in_content_space,
42 AppendQuadsData* append_quads_data) override; 56 AppendQuadsData* append_quads_data) override;
43 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; 57 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override;
44 58
45 void DidBecomeActive() override; 59 void DidBecomeActive() override;
46 size_t did_become_active_call_count() { 60 size_t did_become_active_call_count() {
47 return did_become_active_call_count_; 61 return did_become_active_call_count_;
48 } 62 }
49 63
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 98
85 float ideal_contents_scale() const { return ideal_contents_scale_; } 99 float ideal_contents_scale() const { return ideal_contents_scale_; }
86 float raster_contents_scale() const { return raster_contents_scale_; } 100 float raster_contents_scale() const { return raster_contents_scale_; }
87 101
88 PictureLayerTiling* HighResTiling() const; 102 PictureLayerTiling* HighResTiling() const;
89 PictureLayerTiling* LowResTiling() const; 103 PictureLayerTiling* LowResTiling() const;
90 size_t num_tilings() const { return tilings_->num_tilings(); } 104 size_t num_tilings() const { return tilings_->num_tilings(); }
91 105
92 PictureLayerTilingSet* tilings() { return tilings_.get(); } 106 PictureLayerTilingSet* tilings() { return tilings_.get(); }
93 RasterSource* raster_source() { return raster_source_.get(); } 107 RasterSource* raster_source() { return raster_source_.get(); }
94 void SetRasterSource(scoped_refptr<RasterSource> raster_source); 108 void SetRasterSourceOnPending(scoped_refptr<RasterSource> raster_source,
109 const Region& invalidation,
110 bool is_mask);
95 size_t append_quads_count() { return append_quads_count_; } 111 size_t append_quads_count() { return append_quads_count_; }
96 112
97 const Region& invalidation() const { return invalidation_; } 113 const Region& invalidation() const { return invalidation_; }
98 void set_invalidation(const Region& region) { invalidation_ = region; } 114 void set_invalidation(const Region& region) { invalidation_ = region; }
99 115
100 gfx::Rect visible_rect_for_tile_priority() { 116 gfx::Rect visible_rect_for_tile_priority() {
101 return visible_rect_for_tile_priority_; 117 return visible_rect_for_tile_priority_;
102 } 118 }
103 119
104 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; } 120 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; }
105 121
122 // TODO(danakj): Remove this darn thing.
106 void CreateDefaultTilingsAndTiles(); 123 void CreateDefaultTilingsAndTiles();
124
107 void SetAllTilesVisible(); 125 void SetAllTilesVisible();
108 void SetAllTilesReady(); 126 void SetAllTilesReady();
109 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); 127 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling);
110 void SetTileReady(Tile* tile); 128 void SetTileReady(Tile* tile);
111 void ResetAllTilesPriorities(); 129 void ResetAllTilesPriorities();
112 PictureLayerTilingSet* GetTilings() { return tilings_.get(); } 130 PictureLayerTilingSet* GetTilings() { return tilings_.get(); }
113 131
114 size_t release_resources_count() const { return release_resources_count_; } 132 size_t release_resources_count() const { return release_resources_count_; }
115 void reset_release_resources_count() { release_resources_count_ = 0; } 133 void reset_release_resources_count() { release_resources_count_ = 0; }
116 134
117 void ReleaseResources() override; 135 void ReleaseResources() override;
118 136
119 bool only_used_low_res_last_append_quads() const { 137 bool only_used_low_res_last_append_quads() const {
120 return only_used_low_res_last_append_quads_; 138 return only_used_low_res_last_append_quads_;
121 } 139 }
122 140
123 protected: 141 protected:
124 FakePictureLayerImpl(LayerTreeImpl* tree_impl, 142 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
125 int id, 143 int id,
126 scoped_refptr<RasterSource> raster_source); 144 scoped_refptr<RasterSource> raster_source,
145 bool is_mask);
127 FakePictureLayerImpl(LayerTreeImpl* tree_impl, 146 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
128 int id, 147 int id,
129 scoped_refptr<RasterSource> raster_source, 148 scoped_refptr<RasterSource> raster_source,
149 bool is_mask,
130 const gfx::Size& layer_bounds); 150 const gfx::Size& layer_bounds);
131 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id); 151 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id);
132 152
133 private: 153 private:
134 gfx::Size fixed_tile_size_; 154 gfx::Size fixed_tile_size_;
135 155
136 size_t append_quads_count_; 156 size_t append_quads_count_;
137 size_t did_become_active_call_count_; 157 size_t did_become_active_call_count_;
138 bool has_valid_tile_priorities_; 158 bool has_valid_tile_priorities_;
139 bool use_set_valid_tile_priorities_flag_; 159 bool use_set_valid_tile_priorities_flag_;
140 size_t release_resources_count_; 160 size_t release_resources_count_;
141 }; 161 };
142 162
143 } // namespace cc 163 } // namespace cc
144 164
145 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ 165 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698