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

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: perftest 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(
enne (OOO) 2014/12/01 22:08:17 I'd slightly prefer CreateMaskWithRasterSource and
danakj 2014/12/05 22:30:44 Done.
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) {
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,
35 bool is_mask,
34 const gfx::Size& layer_bounds) { 36 const gfx::Size& layer_bounds) {
35 return make_scoped_ptr( 37 return make_scoped_ptr(new FakePictureLayerImpl(
36 new FakePictureLayerImpl(tree_impl, id, raster_source, layer_bounds)); 38 tree_impl, id, raster_source, is_mask, layer_bounds));
37 } 39 }
38 40
39 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 41 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
42 void PushPropertiesTo(LayerImpl* layer_impl) override;
40 void AppendQuads(RenderPass* render_pass, 43 void AppendQuads(RenderPass* render_pass,
41 const Occlusion& occlusion_in_content_space, 44 const Occlusion& occlusion_in_content_space,
42 AppendQuadsData* append_quads_data) override; 45 AppendQuadsData* append_quads_data) override;
43 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; 46 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override;
44 47
45 void DidBecomeActive() override; 48 void DidBecomeActive() override;
46 size_t did_become_active_call_count() { 49 size_t did_become_active_call_count() {
47 return did_become_active_call_count_; 50 return did_become_active_call_count_;
48 } 51 }
49 52
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 87
85 float ideal_contents_scale() const { return ideal_contents_scale_; } 88 float ideal_contents_scale() const { return ideal_contents_scale_; }
86 float raster_contents_scale() const { return raster_contents_scale_; } 89 float raster_contents_scale() const { return raster_contents_scale_; }
87 90
88 PictureLayerTiling* HighResTiling() const; 91 PictureLayerTiling* HighResTiling() const;
89 PictureLayerTiling* LowResTiling() const; 92 PictureLayerTiling* LowResTiling() const;
90 size_t num_tilings() const { return tilings_->num_tilings(); } 93 size_t num_tilings() const { return tilings_->num_tilings(); }
91 94
92 PictureLayerTilingSet* tilings() { return tilings_.get(); } 95 PictureLayerTilingSet* tilings() { return tilings_.get(); }
93 RasterSource* raster_source() { return raster_source_.get(); } 96 RasterSource* raster_source() { return raster_source_.get(); }
94 void SetRasterSource(scoped_refptr<RasterSource> raster_source); 97 void SetRasterSourceOnPending(scoped_refptr<RasterSource> raster_source,
98 const Region& invalidation,
99 bool is_mask);
95 size_t append_quads_count() { return append_quads_count_; } 100 size_t append_quads_count() { return append_quads_count_; }
96 101
97 const Region& invalidation() const { return invalidation_; } 102 const Region& invalidation() const { return invalidation_; }
98 void set_invalidation(const Region& region) { invalidation_ = region; } 103 void set_invalidation(const Region& region) { invalidation_ = region; }
99 104
100 gfx::Rect visible_rect_for_tile_priority() { 105 gfx::Rect visible_rect_for_tile_priority() {
101 return visible_rect_for_tile_priority_; 106 return visible_rect_for_tile_priority_;
102 } 107 }
103 108
104 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; } 109 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; }
105 110
111 // TODO(danakj): Remove this darn thing.
106 void CreateDefaultTilingsAndTiles(); 112 void CreateDefaultTilingsAndTiles();
113
107 void SetAllTilesVisible(); 114 void SetAllTilesVisible();
108 void SetAllTilesReady(); 115 void SetAllTilesReady();
109 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); 116 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling);
110 void SetTileReady(Tile* tile); 117 void SetTileReady(Tile* tile);
111 void ResetAllTilesPriorities(); 118 void ResetAllTilesPriorities();
112 PictureLayerTilingSet* GetTilings() { return tilings_.get(); } 119 PictureLayerTilingSet* GetTilings() { return tilings_.get(); }
113 120
114 size_t release_resources_count() const { return release_resources_count_; } 121 size_t release_resources_count() const { return release_resources_count_; }
115 void reset_release_resources_count() { release_resources_count_ = 0; } 122 void reset_release_resources_count() { release_resources_count_ = 0; }
116 123
117 void ReleaseResources() override; 124 void ReleaseResources() override;
118 125
119 bool only_used_low_res_last_append_quads() const { 126 bool only_used_low_res_last_append_quads() const {
120 return only_used_low_res_last_append_quads_; 127 return only_used_low_res_last_append_quads_;
121 } 128 }
122 129
123 protected: 130 protected:
124 FakePictureLayerImpl(LayerTreeImpl* tree_impl, 131 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
125 int id, 132 int id,
126 scoped_refptr<RasterSource> raster_source); 133 scoped_refptr<RasterSource> raster_source,
134 bool is_mask);
127 FakePictureLayerImpl(LayerTreeImpl* tree_impl, 135 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
128 int id, 136 int id,
129 scoped_refptr<RasterSource> raster_source, 137 scoped_refptr<RasterSource> raster_source,
138 bool is_mask,
130 const gfx::Size& layer_bounds); 139 const gfx::Size& layer_bounds);
131 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id); 140 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id);
132 141
133 private: 142 private:
134 gfx::Size fixed_tile_size_; 143 gfx::Size fixed_tile_size_;
135 144
136 size_t append_quads_count_; 145 size_t append_quads_count_;
137 size_t did_become_active_call_count_; 146 size_t did_become_active_call_count_;
138 bool has_valid_tile_priorities_; 147 bool has_valid_tile_priorities_;
139 bool use_set_valid_tile_priorities_flag_; 148 bool use_set_valid_tile_priorities_flag_;
140 size_t release_resources_count_; 149 size_t release_resources_count_;
141 }; 150 };
142 151
143 } // namespace cc 152 } // namespace cc
144 153
145 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ 154 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698