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> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "cc/base/unique_notifier.h" | 17 #include "cc/base/unique_notifier.h" |
18 #include "cc/playback/raster_source.h" | 18 #include "cc/playback/raster_source.h" |
19 #include "cc/raster/tile_task_runner.h" | 19 #include "cc/raster/tile_task_runner.h" |
20 #include "cc/resources/memory_history.h" | 20 #include "cc/resources/memory_history.h" |
21 #include "cc/resources/resource_pool.h" | 21 #include "cc/resources/resource_pool.h" |
22 #include "cc/tiles/eviction_tile_priority_queue.h" | 22 #include "cc/tiles/eviction_tile_priority_queue.h" |
| 23 #include "cc/tiles/image_decode_controller.h" |
23 #include "cc/tiles/raster_tile_priority_queue.h" | 24 #include "cc/tiles/raster_tile_priority_queue.h" |
24 #include "cc/tiles/tile.h" | 25 #include "cc/tiles/tile.h" |
25 #include "cc/tiles/tile_draw_info.h" | 26 #include "cc/tiles/tile_draw_info.h" |
26 | 27 |
27 namespace base { | 28 namespace base { |
28 namespace trace_event { | 29 namespace trace_event { |
29 class ConvertableToTraceFormat; | 30 class ConvertableToTraceFormat; |
30 class TracedValue; | 31 class TracedValue; |
31 } | 32 } |
32 } | 33 } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 MemoryUsage operator-(const MemoryUsage& other); | 246 MemoryUsage operator-(const MemoryUsage& other); |
246 | 247 |
247 bool Exceeds(const MemoryUsage& limit) const; | 248 bool Exceeds(const MemoryUsage& limit) const; |
248 int64 memory_bytes() const { return memory_bytes_; } | 249 int64 memory_bytes() const { return memory_bytes_; } |
249 | 250 |
250 private: | 251 private: |
251 int64 memory_bytes_; | 252 int64 memory_bytes_; |
252 int resource_count_; | 253 int resource_count_; |
253 }; | 254 }; |
254 | 255 |
255 void OnImageDecodeTaskCompleted(int layer_id, | |
256 SkPixelRef* pixel_ref, | |
257 bool was_canceled); | |
258 void OnRasterTaskCompleted(Tile::Id tile, | 256 void OnRasterTaskCompleted(Tile::Id tile, |
259 scoped_ptr<ScopedResource> resource, | 257 scoped_ptr<ScopedResource> resource, |
260 const RasterSource::SolidColorAnalysis& analysis, | 258 const RasterSource::SolidColorAnalysis& analysis, |
261 bool was_canceled); | 259 bool was_canceled); |
262 void UpdateTileDrawInfo(Tile* tile, | 260 void UpdateTileDrawInfo(Tile* tile, |
263 scoped_ptr<ScopedResource> resource, | 261 scoped_ptr<ScopedResource> resource, |
264 const RasterSource::SolidColorAnalysis& analysis); | 262 const RasterSource::SolidColorAnalysis& analysis); |
265 | 263 |
266 void FreeResourcesForTile(Tile* tile); | 264 void FreeResourcesForTile(Tile* tile); |
267 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); | 265 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); |
268 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, | |
269 SkPixelRef* pixel_ref); | |
270 scoped_refptr<RasterTask> CreateRasterTask( | 266 scoped_refptr<RasterTask> CreateRasterTask( |
271 const PrioritizedTile& prioritized_tile); | 267 const PrioritizedTile& prioritized_tile); |
272 | 268 |
273 scoped_ptr<EvictionTilePriorityQueue> | 269 scoped_ptr<EvictionTilePriorityQueue> |
274 FreeTileResourcesUntilUsageIsWithinLimit( | 270 FreeTileResourcesUntilUsageIsWithinLimit( |
275 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 271 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
276 const MemoryUsage& limit, | 272 const MemoryUsage& limit, |
277 MemoryUsage* usage); | 273 MemoryUsage* usage); |
278 scoped_ptr<EvictionTilePriorityQueue> | 274 scoped_ptr<EvictionTilePriorityQueue> |
279 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( | 275 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( |
(...skipping 15 matching lines...) Expand all Loading... |
295 | 291 |
296 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 292 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
297 TileMap tiles_; | 293 TileMap tiles_; |
298 | 294 |
299 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; | 295 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; |
300 MemoryHistory::Entry memory_stats_from_last_assign_; | 296 MemoryHistory::Entry memory_stats_from_last_assign_; |
301 | 297 |
302 bool did_check_for_completed_tasks_since_last_schedule_tasks_; | 298 bool did_check_for_completed_tasks_since_last_schedule_tasks_; |
303 bool did_oom_on_last_assign_; | 299 bool did_oom_on_last_assign_; |
304 | 300 |
305 typedef base::hash_map<uint32_t, scoped_refptr<ImageDecodeTask>> | 301 ImageDecodeController image_decode_controller_; |
306 PixelRefTaskMap; | |
307 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; | |
308 LayerPixelRefTaskMap image_decode_tasks_; | |
309 | |
310 typedef base::hash_map<int, int> LayerCountMap; | |
311 LayerCountMap used_layer_counts_; | |
312 | 302 |
313 RasterTaskCompletionStats flush_stats_; | 303 RasterTaskCompletionStats flush_stats_; |
314 | 304 |
315 std::vector<Tile*> released_tiles_; | 305 std::vector<Tile*> released_tiles_; |
316 | 306 |
317 // Queue used when scheduling raster tasks. | 307 // Queue used when scheduling raster tasks. |
318 TileTaskQueue raster_queue_; | 308 TileTaskQueue raster_queue_; |
319 | 309 |
320 std::vector<scoped_refptr<RasterTask>> orphan_raster_tasks_; | 310 std::vector<scoped_refptr<RasterTask>> orphan_raster_tasks_; |
321 | 311 |
(...skipping 17 matching lines...) Expand all Loading... |
339 bool has_scheduled_tile_tasks_; | 329 bool has_scheduled_tile_tasks_; |
340 | 330 |
341 uint64_t prepare_tiles_count_; | 331 uint64_t prepare_tiles_count_; |
342 | 332 |
343 DISALLOW_COPY_AND_ASSIGN(TileManager); | 333 DISALLOW_COPY_AND_ASSIGN(TileManager); |
344 }; | 334 }; |
345 | 335 |
346 } // namespace cc | 336 } // namespace cc |
347 | 337 |
348 #endif // CC_TILES_TILE_MANAGER_H_ | 338 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |