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

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: 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_; }
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 picture_pile_ = pile; 141 picture_pile_ = pile;
141 } 142 }
142 143
143 size_t GPUMemoryUsageInBytes() const; 144 size_t GPUMemoryUsageInBytes() const;
144 145
145 gfx::Size size() const { return size_; } 146 gfx::Size size() const { return size_; }
146 147
147 RasterMode DetermineRasterModeForTree(WhichTree tree) const; 148 RasterMode DetermineRasterModeForTree(WhichTree tree) const;
148 RasterMode DetermineOverallRasterMode() const; 149 RasterMode DetermineOverallRasterMode() const;
149 150
151 void set_tiling_index(int i, int j) {
152 tiling_i_index_ = i;
153 tiling_j_index_ = j;
154 }
155 int tiling_i_index() const { return tiling_i_index_; }
156 int tiling_j_index() const { return tiling_j_index_; }
157
150 // Functionality used in tests. 158 // Functionality used in tests.
151 RasterMode GetRasterModeForTesting() const { 159 RasterMode GetRasterModeForTesting() const {
152 return managed_state().raster_mode; 160 return managed_state().raster_mode;
153 } 161 }
154 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) { 162 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) {
155 return managed_state_.tile_versions[mode]; 163 return managed_state_.tile_versions[mode];
156 } 164 }
157 165
158 private: 166 private:
159 friend class TileManager; 167 friend class TileManager;
(...skipping 27 matching lines...) Expand all
187 float contents_scale_; 195 float contents_scale_;
188 gfx::Rect opaque_rect_; 196 gfx::Rect opaque_rect_;
189 bool is_occluded_[NUM_TREES]; 197 bool is_occluded_[NUM_TREES];
190 198
191 TilePriority priority_[NUM_TREES]; 199 TilePriority priority_[NUM_TREES];
192 ManagedTileState managed_state_; 200 ManagedTileState managed_state_;
193 int layer_id_; 201 int layer_id_;
194 int source_frame_number_; 202 int source_frame_number_;
195 int flags_; 203 int flags_;
196 bool is_shared_; 204 bool is_shared_;
205 int tiling_i_index_;
206 int tiling_j_index_;
207 bool required_for_activation_;
197 208
198 Id id_; 209 Id id_;
199 static Id s_next_id_; 210 static Id s_next_id_;
200 211
201 DISALLOW_COPY_AND_ASSIGN(Tile); 212 DISALLOW_COPY_AND_ASSIGN(Tile);
202 }; 213 };
203 214
204 } // namespace cc 215 } // namespace cc
205 216
206 #endif // CC_RESOURCES_TILE_H_ 217 #endif // CC_RESOURCES_TILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698