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_TILES_TILE_MANAGER_H_ | 5 #ifndef CC_TILES_TILE_MANAGER_H_ |
6 #define CC_TILES_TILE_MANAGER_H_ | 6 #define CC_TILES_TILE_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 132 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
133 return memory_stats_from_last_assign_; | 133 return memory_stats_from_last_assign_; |
134 } | 134 } |
135 | 135 |
136 // Public methods for testing. | 136 // Public methods for testing. |
137 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { | 137 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { |
138 for (size_t i = 0; i < tiles.size(); ++i) { | 138 for (size_t i = 0; i < tiles.size(); ++i) { |
139 TileDrawInfo& draw_info = tiles[i]->draw_info(); | 139 TileDrawInfo& draw_info = tiles[i]->draw_info(); |
140 draw_info.resource_ = resource_pool_->AcquireResource( | 140 draw_info.resource_ = resource_pool_->AcquireResource( |
141 tiles[i]->desired_texture_size(), | 141 tiles[i]->desired_texture_size(), |
142 tile_task_runner_->GetResourceFormat()); | 142 tile_task_runner_->GetResourceFormat(true, false)); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { | 146 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { |
147 for (size_t i = 0; i < tiles.size(); ++i) { | 147 for (size_t i = 0; i < tiles.size(); ++i) { |
148 Tile* tile = tiles[i]; | 148 Tile* tile = tiles[i]; |
149 FreeResourcesForTile(tile); | 149 FreeResourcesForTile(tile); |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 const TilePriority& oother_priority, | 260 const TilePriority& oother_priority, |
261 MemoryUsage* usage); | 261 MemoryUsage* usage); |
262 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); | 262 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); |
263 bool AreRequiredTilesReadyToDraw(RasterTilePriorityQueue::Type type) const; | 263 bool AreRequiredTilesReadyToDraw(RasterTilePriorityQueue::Type type) const; |
264 void NotifyReadyToActivate(); | 264 void NotifyReadyToActivate(); |
265 void NotifyReadyToDraw(); | 265 void NotifyReadyToDraw(); |
266 void CheckIfReadyToActivate(); | 266 void CheckIfReadyToActivate(); |
267 void CheckIfReadyToDraw(); | 267 void CheckIfReadyToDraw(); |
268 void CheckIfMoreTilesNeedToBePrepared(); | 268 void CheckIfMoreTilesNeedToBePrepared(); |
269 | 269 |
| 270 ResourceFormat DetermineResourceFormat(const Tile* tile) const; |
| 271 bool DetermineResourceRequiresSwizzle(const Tile* tile) const; |
| 272 |
270 TileManagerClient* client_; | 273 TileManagerClient* client_; |
271 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 274 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
272 ResourcePool* resource_pool_; | 275 ResourcePool* resource_pool_; |
273 TileTaskRunner* tile_task_runner_; | 276 TileTaskRunner* tile_task_runner_; |
274 GlobalStateThatImpactsTilePriority global_state_; | 277 GlobalStateThatImpactsTilePriority global_state_; |
275 size_t scheduled_raster_task_limit_; | 278 size_t scheduled_raster_task_limit_; |
276 | 279 |
277 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 280 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
278 TileMap tiles_; | 281 TileMap tiles_; |
279 | 282 |
(...skipping 26 matching lines...) Expand all Loading... |
306 | 309 |
307 bool did_notify_ready_to_activate_; | 310 bool did_notify_ready_to_activate_; |
308 bool did_notify_ready_to_draw_; | 311 bool did_notify_ready_to_draw_; |
309 | 312 |
310 DISALLOW_COPY_AND_ASSIGN(TileManager); | 313 DISALLOW_COPY_AND_ASSIGN(TileManager); |
311 }; | 314 }; |
312 | 315 |
313 } // namespace cc | 316 } // namespace cc |
314 | 317 |
315 #endif // CC_TILES_TILE_MANAGER_H_ | 318 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |