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

Side by Side Diff: cc/resources/tile.h

Issue 367833003: cc: Start using raster/eviction iterators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 3 months 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 | Annotate | Revision Log
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_RESOURCES_TILE_H_ 5 #ifndef CC_RESOURCES_TILE_H_
6 #define CC_RESOURCES_TILE_H_ 6 #define CC_RESOURCES_TILE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return TilePriority(priority_[ACTIVE_TREE], 58 return TilePriority(priority_[ACTIVE_TREE],
59 priority_[PENDING_TREE]); 59 priority_[PENDING_TREE]);
60 } 60 }
61 61
62 void SetPriority(WhichTree tree, const TilePriority& priority); 62 void SetPriority(WhichTree tree, const TilePriority& priority);
63 63
64 void set_is_occluded(WhichTree tree, bool is_occluded) { 64 void set_is_occluded(WhichTree tree, bool is_occluded) {
65 is_occluded_[tree] = is_occluded; 65 is_occluded_[tree] = is_occluded;
66 } 66 }
67 67
68 bool is_occluded(WhichTree tree) const { return is_occluded_[tree]; } 68 bool is_occluded(WhichTree tree) const { return is_occluded_[tree]; }
danakj 2014/09/19 01:41:47 can you TODO about removing this and always using
vmpstr 2014/09/19 21:22:53 Done.
69 69
70 void set_shared(bool is_shared) { is_shared_ = is_shared; } 70 void set_shared(bool is_shared) { is_shared_ = is_shared; }
71 bool is_shared() const { return is_shared_; } 71 bool is_shared() const { return is_shared_; }
72 72
73 bool is_occluded_for_tree_priority(TreePriority tree_priority) const { 73 bool is_occluded_for_tree_priority(TreePriority tree_priority) const {
74 switch (tree_priority) { 74 switch (tree_priority) {
75 case SMOOTHNESS_TAKES_PRIORITY: 75 case SMOOTHNESS_TAKES_PRIORITY:
76 return is_occluded_[ACTIVE_TREE]; 76 return is_occluded_[ACTIVE_TREE];
77 case NEW_CONTENT_TAKES_PRIORITY: 77 case NEW_CONTENT_TAKES_PRIORITY:
78 return is_occluded_[PENDING_TREE]; 78 return is_occluded_[PENDING_TREE];
79 case SAME_PRIORITY_FOR_BOTH_TREES: 79 case SAME_PRIORITY_FOR_BOTH_TREES:
80 return is_occluded_[ACTIVE_TREE] && is_occluded_[PENDING_TREE]; 80 return is_occluded_[ACTIVE_TREE] && is_occluded_[PENDING_TREE];
81 default: 81 default:
82 NOTREACHED(); 82 NOTREACHED();
83 return false; 83 return false;
84 } 84 }
85 } 85 }
86 86
87 void MarkRequiredForActivation(); 87 bool required_for_activation() const { return required_for_activation_; }
danakj 2014/09/19 01:41:47 can you TODO to remove this and always use IsTileR
vmpstr 2014/09/19 21:22:53 Done.
88 88 void set_required_for_activation(bool is_required) {
89 bool required_for_activation() const { 89 required_for_activation_ = is_required;
90 return priority_[PENDING_TREE].required_for_activation;
91 } 90 }
92 91
93 bool use_picture_analysis() const { 92 bool use_picture_analysis() const {
94 return !!(flags_ & USE_PICTURE_ANALYSIS); 93 return !!(flags_ & USE_PICTURE_ANALYSIS);
95 } 94 }
96 95
97 bool NeedsRasterForMode(RasterMode mode) const { 96 bool NeedsRasterForMode(RasterMode mode) const {
98 return !managed_state_.tile_versions[mode].IsReadyToDraw(); 97 return managed_state_.tile_versions[mode].mode() ==
98 ManagedTileState::TileVersion::PICTURE_PILE_MODE ||
99 !managed_state_.tile_versions[mode].IsReadyToDraw();
99 } 100 }
100 101
101 bool HasResources() const { 102 bool HasResources() const {
102 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { 103 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) {
103 if (managed_state_.tile_versions[mode].has_resource()) 104 if (managed_state_.tile_versions[mode].has_resource())
104 return true; 105 return true;
105 } 106 }
106 return false; 107 return false;
107 } 108 }
108 109
(...skipping 30 matching lines...) Expand all
139 picture_pile_ = pile; 140 picture_pile_ = pile;
140 } 141 }
141 142
142 size_t GPUMemoryUsageInBytes() const; 143 size_t GPUMemoryUsageInBytes() const;
143 144
144 gfx::Size size() const { return size_; } 145 gfx::Size size() const { return size_; }
145 146
146 RasterMode DetermineRasterModeForTree(WhichTree tree) const; 147 RasterMode DetermineRasterModeForTree(WhichTree tree) const;
147 RasterMode DetermineOverallRasterMode() const; 148 RasterMode DetermineOverallRasterMode() const;
148 149
150 void set_tiling_index(int i, int j) {
151 tiling_i_index_ = i;
152 tiling_j_index_ = j;
153 }
154 int tiling_i_index() const { return tiling_i_index_; }
155 int tiling_j_index() const { return tiling_j_index_; }
156
149 // Functionality used in tests. 157 // Functionality used in tests.
150 RasterMode GetRasterModeForTesting() const { 158 RasterMode GetRasterModeForTesting() const {
151 return managed_state().raster_mode; 159 return managed_state().raster_mode;
152 } 160 }
153 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) { 161 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) {
154 return managed_state_.tile_versions[mode]; 162 return managed_state_.tile_versions[mode];
155 } 163 }
156 164
157 private: 165 private:
158 friend class TileManager; 166 friend class TileManager;
(...skipping 25 matching lines...) Expand all
184 gfx::Rect content_rect_; 192 gfx::Rect content_rect_;
185 float contents_scale_; 193 float contents_scale_;
186 bool is_occluded_[NUM_TREES]; 194 bool is_occluded_[NUM_TREES];
187 195
188 TilePriority priority_[NUM_TREES]; 196 TilePriority priority_[NUM_TREES];
189 ManagedTileState managed_state_; 197 ManagedTileState managed_state_;
190 int layer_id_; 198 int layer_id_;
191 int source_frame_number_; 199 int source_frame_number_;
192 int flags_; 200 int flags_;
193 bool is_shared_; 201 bool is_shared_;
202 int tiling_i_index_;
203 int tiling_j_index_;
204 bool required_for_activation_;
194 205
195 Id id_; 206 Id id_;
196 static Id s_next_id_; 207 static Id s_next_id_;
197 208
198 DISALLOW_COPY_AND_ASSIGN(Tile); 209 DISALLOW_COPY_AND_ASSIGN(Tile);
199 }; 210 };
200 211
201 } // namespace cc 212 } // namespace cc
202 213
203 #endif // CC_RESOURCES_TILE_H_ 214 #endif // CC_RESOURCES_TILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698