| 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_RESOURCES_TILE_MANAGER_H_ | 5 #ifndef CC_RESOURCES_TILE_MANAGER_H_ |
| 6 #define CC_RESOURCES_TILE_MANAGER_H_ | 6 #define CC_RESOURCES_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/ref_counted_managed.h" | 17 #include "cc/base/ref_counted_managed.h" |
| 18 #include "cc/base/unique_notifier.h" | 18 #include "cc/base/unique_notifier.h" |
| 19 #include "cc/debug/rendering_stats_instrumentation.h" | |
| 20 #include "cc/resources/eviction_tile_priority_queue.h" | 19 #include "cc/resources/eviction_tile_priority_queue.h" |
| 21 #include "cc/resources/managed_tile_state.h" | 20 #include "cc/resources/managed_tile_state.h" |
| 22 #include "cc/resources/memory_history.h" | 21 #include "cc/resources/memory_history.h" |
| 23 #include "cc/resources/raster_source.h" | 22 #include "cc/resources/raster_source.h" |
| 24 #include "cc/resources/raster_tile_priority_queue.h" | 23 #include "cc/resources/raster_tile_priority_queue.h" |
| 25 #include "cc/resources/resource_pool.h" | 24 #include "cc/resources/resource_pool.h" |
| 26 #include "cc/resources/tile.h" | 25 #include "cc/resources/tile.h" |
| 27 #include "cc/resources/tile_task_runner.h" | 26 #include "cc/resources/tile_task_runner.h" |
| 28 | 27 |
| 29 namespace base { | 28 namespace base { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 REQUIRED_FOR_DRAW | 94 REQUIRED_FOR_DRAW |
| 96 // Adding additional values requires increasing kNumberOfTaskSets in | 95 // Adding additional values requires increasing kNumberOfTaskSets in |
| 97 // rasterizer.h | 96 // rasterizer.h |
| 98 }; | 97 }; |
| 99 | 98 |
| 100 static scoped_ptr<TileManager> Create( | 99 static scoped_ptr<TileManager> Create( |
| 101 TileManagerClient* client, | 100 TileManagerClient* client, |
| 102 base::SequencedTaskRunner* task_runner, | 101 base::SequencedTaskRunner* task_runner, |
| 103 ResourcePool* resource_pool, | 102 ResourcePool* resource_pool, |
| 104 TileTaskRunner* tile_task_runner, | 103 TileTaskRunner* tile_task_runner, |
| 105 RenderingStatsInstrumentation* rendering_stats_instrumentation, | |
| 106 size_t scheduled_raster_task_limit); | 104 size_t scheduled_raster_task_limit); |
| 107 ~TileManager() override; | 105 ~TileManager() override; |
| 108 | 106 |
| 109 // Assigns tile memory and schedules work to prepare tiles for drawing. | 107 // Assigns tile memory and schedules work to prepare tiles for drawing. |
| 110 // - Runs client_->NotifyReadyToActivate() when all tiles required for | 108 // - Runs client_->NotifyReadyToActivate() when all tiles required for |
| 111 // activation are prepared, or failed to prepare due to OOM. | 109 // activation are prepared, or failed to prepare due to OOM. |
| 112 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are | 110 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are |
| 113 // prepared, or failed to prepare due to OOM. | 111 // prepared, or failed to prepare due to OOM. |
| 114 void PrepareTiles(const GlobalStateThatImpactsTilePriority& state); | 112 void PrepareTiles(const GlobalStateThatImpactsTilePriority& state); |
| 115 | 113 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 167 |
| 170 void SetScheduledRasterTaskLimitForTesting(size_t limit) { | 168 void SetScheduledRasterTaskLimitForTesting(size_t limit) { |
| 171 scheduled_raster_task_limit_ = limit; | 169 scheduled_raster_task_limit_ = limit; |
| 172 } | 170 } |
| 173 | 171 |
| 174 protected: | 172 protected: |
| 175 TileManager(TileManagerClient* client, | 173 TileManager(TileManagerClient* client, |
| 176 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 174 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 177 ResourcePool* resource_pool, | 175 ResourcePool* resource_pool, |
| 178 TileTaskRunner* tile_task_runner, | 176 TileTaskRunner* tile_task_runner, |
| 179 RenderingStatsInstrumentation* rendering_stats_instrumentation, | |
| 180 size_t scheduled_raster_task_limit); | 177 size_t scheduled_raster_task_limit); |
| 181 | 178 |
| 182 void FreeResourcesForReleasedTiles(); | 179 void FreeResourcesForReleasedTiles(); |
| 183 void CleanUpReleasedTiles(); | 180 void CleanUpReleasedTiles(); |
| 184 | 181 |
| 185 // Overriden from RefCountedManager<Tile>: | 182 // Overriden from RefCountedManager<Tile>: |
| 186 friend class Tile; | 183 friend class Tile; |
| 187 void Release(Tile* tile) override; | 184 void Release(Tile* tile) override; |
| 188 | 185 |
| 189 // Overriden from TileTaskRunnerClient: | 186 // Overriden from TileTaskRunnerClient: |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 TileTaskRunner* tile_task_runner_; | 250 TileTaskRunner* tile_task_runner_; |
| 254 GlobalStateThatImpactsTilePriority global_state_; | 251 GlobalStateThatImpactsTilePriority global_state_; |
| 255 size_t scheduled_raster_task_limit_; | 252 size_t scheduled_raster_task_limit_; |
| 256 | 253 |
| 257 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 254 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
| 258 TileMap tiles_; | 255 TileMap tiles_; |
| 259 | 256 |
| 260 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; | 257 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; |
| 261 MemoryHistory::Entry memory_stats_from_last_assign_; | 258 MemoryHistory::Entry memory_stats_from_last_assign_; |
| 262 | 259 |
| 263 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | |
| 264 | |
| 265 bool did_check_for_completed_tasks_since_last_schedule_tasks_; | 260 bool did_check_for_completed_tasks_since_last_schedule_tasks_; |
| 266 bool did_oom_on_last_assign_; | 261 bool did_oom_on_last_assign_; |
| 267 | 262 |
| 268 typedef base::hash_map<uint32_t, scoped_refptr<ImageDecodeTask>> | 263 typedef base::hash_map<uint32_t, scoped_refptr<ImageDecodeTask>> |
| 269 PixelRefTaskMap; | 264 PixelRefTaskMap; |
| 270 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; | 265 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; |
| 271 LayerPixelRefTaskMap image_decode_tasks_; | 266 LayerPixelRefTaskMap image_decode_tasks_; |
| 272 | 267 |
| 273 typedef base::hash_map<int, int> LayerCountMap; | 268 typedef base::hash_map<int, int> LayerCountMap; |
| 274 LayerCountMap used_layer_counts_; | 269 LayerCountMap used_layer_counts_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 293 | 288 |
| 294 bool did_notify_ready_to_activate_; | 289 bool did_notify_ready_to_activate_; |
| 295 bool did_notify_ready_to_draw_; | 290 bool did_notify_ready_to_draw_; |
| 296 | 291 |
| 297 DISALLOW_COPY_AND_ASSIGN(TileManager); | 292 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 298 }; | 293 }; |
| 299 | 294 |
| 300 } // namespace cc | 295 } // namespace cc |
| 301 | 296 |
| 302 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 297 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |