OLD | NEW |
---|---|
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_TILE_MANAGER_H_ | 5 #ifndef CC_TILE_MANAGER_H_ |
6 #define CC_TILE_MANAGER_H_ | 6 #define CC_TILE_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 | 96 |
97 // This class manages tiles, deciding which should get rasterized and which | 97 // This class manages tiles, deciding which should get rasterized and which |
98 // should no longer have any memory assigned to them. Tile objects are "owned" | 98 // should no longer have any memory assigned to them. Tile objects are "owned" |
99 // by layers; they automatically register with the manager when they are | 99 // by layers; they automatically register with the manager when they are |
100 // created, and unregister from the manager when they are deleted. | 100 // created, and unregister from the manager when they are deleted. |
101 class CC_EXPORT TileManager : public WorkerPoolClient { | 101 class CC_EXPORT TileManager : public WorkerPoolClient { |
102 public: | 102 public: |
103 TileManager(TileManagerClient* client, | 103 TileManager(TileManagerClient* client, |
104 ResourceProvider *resource_provider, | 104 ResourceProvider *resource_provider, |
105 size_t num_raster_threads, | 105 size_t num_raster_threads, |
106 bool use_cheapess_estimator); | 106 bool use_cheapess_estimator, |
107 bool solid_color_benchmarking); | |
reveman
2013/02/26 23:34:40
is there something we can do to cleanup the names
| |
107 virtual ~TileManager(); | 108 virtual ~TileManager(); |
108 | 109 |
109 const GlobalStateThatImpactsTilePriority& GlobalState() const { | 110 const GlobalStateThatImpactsTilePriority& GlobalState() const { |
110 return global_state_; | 111 return global_state_; |
111 } | 112 } |
112 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); | 113 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); |
113 | 114 |
114 void ManageTiles(); | 115 void ManageTiles(); |
115 void CheckForCompletedTileUploads(); | 116 void CheckForCompletedTileUploads(); |
116 void AbortPendingTileUploads(); | 117 void AbortPendingTileUploads(); |
(...skipping 25 matching lines...) Expand all Loading... | |
142 // TODO(nduca): Do something smarter if reprioritization turns out to be | 143 // TODO(nduca): Do something smarter if reprioritization turns out to be |
143 // costly. | 144 // costly. |
144 ScheduleManageTiles(); | 145 ScheduleManageTiles(); |
145 } | 146 } |
146 | 147 |
147 private: | 148 private: |
148 | 149 |
149 // Data that is passed to raster tasks. | 150 // Data that is passed to raster tasks. |
150 struct RasterTaskMetadata { | 151 struct RasterTaskMetadata { |
151 bool use_cheapness_estimator; | 152 bool use_cheapness_estimator; |
153 bool solid_color_benchmarking; | |
152 bool is_tile_in_pending_tree_now_bin; | 154 bool is_tile_in_pending_tree_now_bin; |
153 TileResolution tile_resolution; | 155 TileResolution tile_resolution; |
154 }; | 156 }; |
155 | 157 |
156 RasterTaskMetadata GetRasterTaskMetadata(const Tile& tile) const; | 158 RasterTaskMetadata GetRasterTaskMetadata(const Tile& tile) const; |
159 | |
157 void SortTiles(); | 160 void SortTiles(); |
158 void AssignGpuMemoryToTiles(); | 161 void AssignGpuMemoryToTiles(); |
159 void FreeResourcesForTile(Tile* tile); | 162 void FreeResourcesForTile(Tile* tile); |
160 void ScheduleManageTiles() { | 163 void ScheduleManageTiles() { |
161 if (manage_tiles_pending_) | 164 if (manage_tiles_pending_) |
162 return; | 165 return; |
163 client_->ScheduleManageTiles(); | 166 client_->ScheduleManageTiles(); |
164 manage_tiles_pending_ = true; | 167 manage_tiles_pending_ = true; |
165 } | 168 } |
166 void DispatchMoreTasks(); | 169 void DispatchMoreTasks(); |
(...skipping 22 matching lines...) Expand all Loading... | |
189 const gfx::Rect& rect, | 192 const gfx::Rect& rect, |
190 float contents_scale, | 193 float contents_scale, |
191 const RasterTaskMetadata& metadata, | 194 const RasterTaskMetadata& metadata, |
192 PicturePileImpl* picture_pile, | 195 PicturePileImpl* picture_pile, |
193 RenderingStats* stats); | 196 RenderingStats* stats); |
194 static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, | 197 static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, |
195 RenderingStats* stats); | 198 RenderingStats* stats); |
196 | 199 |
197 static void RecordCheapnessPredictorResults(bool is_predicted_cheap, | 200 static void RecordCheapnessPredictorResults(bool is_predicted_cheap, |
198 bool is_actually_cheap); | 201 bool is_actually_cheap); |
202 static void RecordSolidColorPredictorResults(const uint8* actual_bytes, | |
203 size_t pixel_count, | |
204 bool is_predicted_solid, | |
205 SkColor predicted_color, | |
206 bool is_predicted_transparent); | |
199 | 207 |
200 TileManagerClient* client_; | 208 TileManagerClient* client_; |
201 scoped_ptr<ResourcePool> resource_pool_; | 209 scoped_ptr<ResourcePool> resource_pool_; |
202 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 210 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
203 bool manage_tiles_pending_; | 211 bool manage_tiles_pending_; |
204 int manage_tiles_call_count_; | 212 int manage_tiles_call_count_; |
205 | 213 |
206 GlobalStateThatImpactsTilePriority global_state_; | 214 GlobalStateThatImpactsTilePriority global_state_; |
207 | 215 |
208 typedef std::vector<Tile*> TileVector; | 216 typedef std::vector<Tile*> TileVector; |
(...skipping 17 matching lines...) Expand all Loading... | |
226 bool ever_exceeded_memory_budget_; | 234 bool ever_exceeded_memory_budget_; |
227 MemoryHistory::Entry memory_stats_from_last_assign_; | 235 MemoryHistory::Entry memory_stats_from_last_assign_; |
228 | 236 |
229 bool record_rendering_stats_; | 237 bool record_rendering_stats_; |
230 RenderingStats rendering_stats_; | 238 RenderingStats rendering_stats_; |
231 | 239 |
232 bool use_cheapness_estimator_; | 240 bool use_cheapness_estimator_; |
233 bool did_schedule_cheap_tasks_; | 241 bool did_schedule_cheap_tasks_; |
234 bool allow_cheap_tasks_; | 242 bool allow_cheap_tasks_; |
235 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; | 243 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; |
244 bool solid_color_benchmarking_; | |
236 | 245 |
237 DISALLOW_COPY_AND_ASSIGN(TileManager); | 246 DISALLOW_COPY_AND_ASSIGN(TileManager); |
238 }; | 247 }; |
239 | 248 |
240 } // namespace cc | 249 } // namespace cc |
241 | 250 |
242 #endif // CC_TILE_MANAGER_H_ | 251 #endif // CC_TILE_MANAGER_H_ |
OLD | NEW |