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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 190 } |
191 | 191 |
192 void SetMoreTilesNeedToBeRasterizedForTesting() { | 192 void SetMoreTilesNeedToBeRasterizedForTesting() { |
193 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; | 193 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; |
194 } | 194 } |
195 | 195 |
196 bool HasScheduledTileTasksForTesting() const { | 196 bool HasScheduledTileTasksForTesting() const { |
197 return has_scheduled_tile_tasks_; | 197 return has_scheduled_tile_tasks_; |
198 } | 198 } |
199 | 199 |
| 200 void OnRasterTaskCompleted(std::unique_ptr<RasterBuffer> raster_buffer, |
| 201 Tile* tile, |
| 202 Resource* resource, |
| 203 bool was_canceled); |
| 204 |
200 protected: | 205 protected: |
201 TileManager(TileManagerClient* client, | 206 TileManager(TileManagerClient* client, |
202 scoped_refptr<base::SequencedTaskRunner> task_runner, | 207 scoped_refptr<base::SequencedTaskRunner> task_runner, |
203 size_t scheduled_raster_task_limit, | 208 size_t scheduled_raster_task_limit, |
204 bool use_partial_raster); | 209 bool use_partial_raster); |
205 | 210 |
206 void FreeResourcesForReleasedTiles(); | 211 void FreeResourcesForReleasedTiles(); |
207 void CleanUpReleasedTiles(); | 212 void CleanUpReleasedTiles(); |
208 | 213 |
209 friend class Tile; | 214 friend class Tile; |
(...skipping 27 matching lines...) Expand all Loading... |
237 MemoryUsage operator-(const MemoryUsage& other); | 242 MemoryUsage operator-(const MemoryUsage& other); |
238 | 243 |
239 bool Exceeds(const MemoryUsage& limit) const; | 244 bool Exceeds(const MemoryUsage& limit) const; |
240 int64_t memory_bytes() const { return memory_bytes_; } | 245 int64_t memory_bytes() const { return memory_bytes_; } |
241 | 246 |
242 private: | 247 private: |
243 int64_t memory_bytes_; | 248 int64_t memory_bytes_; |
244 int resource_count_; | 249 int resource_count_; |
245 }; | 250 }; |
246 | 251 |
247 void OnRasterTaskCompleted( | |
248 Tile::Id tile, | |
249 Resource* resource, | |
250 bool was_canceled); | |
251 | |
252 void FreeResourcesForTile(Tile* tile); | 252 void FreeResourcesForTile(Tile* tile); |
253 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); | 253 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); |
254 scoped_refptr<TileTask> CreateRasterTask( | 254 scoped_refptr<TileTask> CreateRasterTask( |
255 const PrioritizedTile& prioritized_tile); | 255 const PrioritizedTile& prioritized_tile); |
256 | 256 |
257 std::unique_ptr<EvictionTilePriorityQueue> | 257 std::unique_ptr<EvictionTilePriorityQueue> |
258 FreeTileResourcesUntilUsageIsWithinLimit( | 258 FreeTileResourcesUntilUsageIsWithinLimit( |
259 std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 259 std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
260 const MemoryUsage& limit, | 260 const MemoryUsage& limit, |
261 MemoryUsage* usage); | 261 MemoryUsage* usage); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 std::unordered_map<Tile::Id, std::vector<DrawImage>> scheduled_draw_images_; | 341 std::unordered_map<Tile::Id, std::vector<DrawImage>> scheduled_draw_images_; |
342 | 342 |
343 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 343 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
344 | 344 |
345 DISALLOW_COPY_AND_ASSIGN(TileManager); | 345 DISALLOW_COPY_AND_ASSIGN(TileManager); |
346 }; | 346 }; |
347 | 347 |
348 } // namespace cc | 348 } // namespace cc |
349 | 349 |
350 #endif // CC_TILES_TILE_MANAGER_H_ | 350 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |