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

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

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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/test/fake_output_surface_client.cc ('k') | cc/test/fake_picture_layer_impl.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 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 pile that covers the entire layer. 20 // Create layer from a raster source that covers the entire layer.
21 static scoped_ptr<FakePictureLayerImpl> CreateWithPile( 21 static scoped_ptr<FakePictureLayerImpl> CreateWithRasterSource(
22 LayerTreeImpl* tree_impl, int id, scoped_refptr<PicturePileImpl> pile) { 22 LayerTreeImpl* tree_impl,
23 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, pile)); 23 int id,
24 scoped_refptr<RasterSource> raster_source) {
25 return make_scoped_ptr(
26 new FakePictureLayerImpl(tree_impl, id, raster_source));
24 } 27 }
25 28
26 // Create layer from a pile that only covers part of the layer. 29 // Create layer from a raster source that only covers part of the layer.
27 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialPile( 30 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource(
28 LayerTreeImpl* tree_impl, 31 LayerTreeImpl* tree_impl,
29 int id, 32 int id,
30 scoped_refptr<PicturePileImpl> pile, 33 scoped_refptr<RasterSource> raster_source,
31 const gfx::Size& layer_bounds) { 34 const gfx::Size& layer_bounds) {
32 return make_scoped_ptr( 35 return make_scoped_ptr(
33 new FakePictureLayerImpl(tree_impl, id, pile, layer_bounds)); 36 new FakePictureLayerImpl(tree_impl, id, raster_source, layer_bounds));
34 } 37 }
35 38
36 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 39 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
37 void AppendQuads(RenderPass* render_pass, 40 void AppendQuads(RenderPass* render_pass,
38 const Occlusion& occlusion_in_content_space, 41 const Occlusion& occlusion_in_content_space,
39 AppendQuadsData* append_quads_data) override; 42 AppendQuadsData* append_quads_data) override;
40 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; 43 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override;
41 44
42 void DidBecomeActive() override; 45 void DidBecomeActive() override;
43 size_t did_become_active_call_count() { 46 size_t did_become_active_call_count() {
44 return did_become_active_call_count_; 47 return did_become_active_call_count_;
45 } 48 }
46 49
47 bool HasValidTilePriorities() const override; 50 bool HasValidTilePriorities() const override;
48 void set_has_valid_tile_priorities(bool has_valid_priorities) { 51 void set_has_valid_tile_priorities(bool has_valid_priorities) {
49 has_valid_tile_priorities_ = has_valid_priorities; 52 has_valid_tile_priorities_ = has_valid_priorities;
50 use_set_valid_tile_priorities_flag_ = true; 53 use_set_valid_tile_priorities_flag_ = true;
51 } 54 }
52 55
56 size_t CountTilesRequired(
57 TileRequirementCheck is_tile_required_callback) const;
58 size_t CountTilesRequiredForActivation() const;
59 size_t CountTilesRequiredForDraw() const;
60
53 using PictureLayerImpl::AddTiling; 61 using PictureLayerImpl::AddTiling;
54 using PictureLayerImpl::CleanUpTilingsOnActiveLayer; 62 using PictureLayerImpl::CleanUpTilingsOnActiveLayer;
55 using PictureLayerImpl::CanHaveTilings; 63 using PictureLayerImpl::CanHaveTilings;
56 using PictureLayerImpl::DoPostCommitInitializationIfNeeded; 64 using PictureLayerImpl::DoPostCommitInitializationIfNeeded;
57 using PictureLayerImpl::MinimumContentsScale; 65 using PictureLayerImpl::MinimumContentsScale;
58 using PictureLayerImpl::GetViewportForTilePriorityInContentSpace; 66 using PictureLayerImpl::GetViewportForTilePriorityInContentSpace;
59 using PictureLayerImpl::SanityCheckTilingState; 67 using PictureLayerImpl::SanityCheckTilingState;
60 using PictureLayerImpl::GetRecycledTwinLayer; 68 using PictureLayerImpl::GetRecycledTwinLayer;
61 using PictureLayerImpl::UpdatePile; 69 using PictureLayerImpl::UpdateRasterSource;
62 70
63 using PictureLayerImpl::UpdateIdealScales; 71 using PictureLayerImpl::UpdateIdealScales;
64 using PictureLayerImpl::MaximumTilingContentsScale; 72 using PictureLayerImpl::MaximumTilingContentsScale;
65 73
66 void SetNeedsPostCommitInitialization() { 74 void SetNeedsPostCommitInitialization() {
67 needs_post_commit_initialization_ = true; 75 needs_post_commit_initialization_ = true;
68 } 76 }
69 77
70 bool needs_post_commit_initialization() const { 78 bool needs_post_commit_initialization() const {
71 return needs_post_commit_initialization_; 79 return needs_post_commit_initialization_;
72 } 80 }
73 81
74 float raster_page_scale() const { return raster_page_scale_; } 82 float raster_page_scale() const { return raster_page_scale_; }
75 void set_raster_page_scale(float scale) { raster_page_scale_ = scale; } 83 void set_raster_page_scale(float scale) { raster_page_scale_ = scale; }
76 84
77 float ideal_contents_scale() const { return ideal_contents_scale_; } 85 float ideal_contents_scale() const { return ideal_contents_scale_; }
78 float raster_contents_scale() const { return raster_contents_scale_; } 86 float raster_contents_scale() const { return raster_contents_scale_; }
79 87
80 PictureLayerTiling* HighResTiling() const; 88 PictureLayerTiling* HighResTiling() const;
81 PictureLayerTiling* LowResTiling() const; 89 PictureLayerTiling* LowResTiling() const;
82 size_t num_tilings() const { return tilings_->num_tilings(); } 90 size_t num_tilings() const { return tilings_->num_tilings(); }
83 91
84 PictureLayerTilingSet* tilings() { return tilings_.get(); } 92 PictureLayerTilingSet* tilings() { return tilings_.get(); }
85 PicturePileImpl* pile() { return pile_.get(); } 93 RasterSource* raster_source() { return raster_source_.get(); }
86 void SetPile(scoped_refptr<PicturePileImpl> pile); 94 void SetRasterSource(scoped_refptr<RasterSource> raster_source);
87 size_t append_quads_count() { return append_quads_count_; } 95 size_t append_quads_count() { return append_quads_count_; }
88 96
89 const Region& invalidation() const { return invalidation_; } 97 const Region& invalidation() const { return invalidation_; }
90 void set_invalidation(const Region& region) { invalidation_ = region; } 98 void set_invalidation(const Region& region) { invalidation_ = region; }
91 99
92 gfx::Rect visible_rect_for_tile_priority() { 100 gfx::Rect visible_rect_for_tile_priority() {
93 return visible_rect_for_tile_priority_; 101 return visible_rect_for_tile_priority_;
94 } 102 }
95 103
96 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; } 104 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; }
97 105
98 void CreateDefaultTilingsAndTiles(); 106 void CreateDefaultTilingsAndTiles();
99 void SetAllTilesVisible(); 107 void SetAllTilesVisible();
100 void SetAllTilesReady(); 108 void SetAllTilesReady();
101 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); 109 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling);
102 void SetTileReady(Tile* tile); 110 void SetTileReady(Tile* tile);
103 void ResetAllTilesPriorities(); 111 void ResetAllTilesPriorities();
104 PictureLayerTilingSet* GetTilings() { return tilings_.get(); } 112 PictureLayerTilingSet* GetTilings() { return tilings_.get(); }
105 113
106 size_t release_resources_count() const { return release_resources_count_; } 114 size_t release_resources_count() const { return release_resources_count_; }
107 void reset_release_resources_count() { release_resources_count_ = 0; } 115 void reset_release_resources_count() { release_resources_count_ = 0; }
108 116
109 void ReleaseResources() override; 117 void ReleaseResources() override;
110 118
111 bool only_used_low_res_last_append_quads() const { 119 bool only_used_low_res_last_append_quads() const {
112 return only_used_low_res_last_append_quads_; 120 return only_used_low_res_last_append_quads_;
113 } 121 }
114 122
115 protected: 123 protected:
116 FakePictureLayerImpl(
117 LayerTreeImpl* tree_impl,
118 int id,
119 scoped_refptr<PicturePileImpl> pile);
120 FakePictureLayerImpl(LayerTreeImpl* tree_impl, 124 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
121 int id, 125 int id,
122 scoped_refptr<PicturePileImpl> pile, 126 scoped_refptr<RasterSource> raster_source);
127 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
128 int id,
129 scoped_refptr<RasterSource> raster_source,
123 const gfx::Size& layer_bounds); 130 const gfx::Size& layer_bounds);
124 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id); 131 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id);
125 132
126 private: 133 private:
127 gfx::Size fixed_tile_size_; 134 gfx::Size fixed_tile_size_;
128 135
129 size_t append_quads_count_; 136 size_t append_quads_count_;
130 size_t did_become_active_call_count_; 137 size_t did_become_active_call_count_;
131 bool has_valid_tile_priorities_; 138 bool has_valid_tile_priorities_;
132 bool use_set_valid_tile_priorities_flag_; 139 bool use_set_valid_tile_priorities_flag_;
133 size_t release_resources_count_; 140 size_t release_resources_count_;
134 }; 141 };
135 142
136 } // namespace cc 143 } // namespace cc
137 144
138 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ 145 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/test/fake_output_surface_client.cc ('k') | cc/test/fake_picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698