| 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 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <unordered_map> | 13 #include <unordered_map> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "cc/base/unique_notifier.h" | 19 #include "cc/base/unique_notifier.h" |
| 20 #include "cc/playback/raster_source.h" | 20 #include "cc/playback/raster_source.h" |
| 21 #include "cc/raster/raster_buffer_provider.h" | 21 #include "cc/raster/raster_buffer_provider.h" |
| 22 #include "cc/resources/memory_history.h" | 22 #include "cc/resources/memory_history.h" |
| 23 #include "cc/resources/resource_pool.h" | 23 #include "cc/resources/resource_pool.h" |
| 24 #include "cc/tiles/decoded_image_tracker.h" |
| 24 #include "cc/tiles/eviction_tile_priority_queue.h" | 25 #include "cc/tiles/eviction_tile_priority_queue.h" |
| 25 #include "cc/tiles/image_controller.h" | 26 #include "cc/tiles/image_controller.h" |
| 26 #include "cc/tiles/raster_tile_priority_queue.h" | 27 #include "cc/tiles/raster_tile_priority_queue.h" |
| 27 #include "cc/tiles/tile.h" | 28 #include "cc/tiles/tile.h" |
| 28 #include "cc/tiles/tile_draw_info.h" | 29 #include "cc/tiles/tile_draw_info.h" |
| 29 #include "cc/tiles/tile_task_manager.h" | 30 #include "cc/tiles/tile_task_manager.h" |
| 30 | 31 |
| 31 namespace base { | 32 namespace base { |
| 32 namespace trace_event { | 33 namespace trace_event { |
| 33 class ConvertableToTraceFormat; | 34 class ConvertableToTraceFormat; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 92 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 92 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); | 93 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); |
| 93 | 94 |
| 94 // This class manages tiles, deciding which should get rasterized and which | 95 // This class manages tiles, deciding which should get rasterized and which |
| 95 // should no longer have any memory assigned to them. Tile objects are "owned" | 96 // should no longer have any memory assigned to them. Tile objects are "owned" |
| 96 // by layers; they automatically register with the manager when they are | 97 // by layers; they automatically register with the manager when they are |
| 97 // created, and unregister from the manager when they are deleted. | 98 // created, and unregister from the manager when they are deleted. |
| 98 class CC_EXPORT TileManager { | 99 class CC_EXPORT TileManager { |
| 99 public: | 100 public: |
| 100 TileManager(TileManagerClient* client, | 101 TileManager(TileManagerClient* client, |
| 101 base::SequencedTaskRunner* task_runner, | 102 base::SequencedTaskRunner* origin_task_runner, |
| 103 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner, |
| 102 size_t scheduled_raster_task_limit, | 104 size_t scheduled_raster_task_limit, |
| 103 bool use_partial_raster, | 105 bool use_partial_raster, |
| 104 bool check_tile_priority_inversion); | 106 bool check_tile_priority_inversion); |
| 105 virtual ~TileManager(); | 107 virtual ~TileManager(); |
| 106 | 108 |
| 107 // Assigns tile memory and schedules work to prepare tiles for drawing. | 109 // Assigns tile memory and schedules work to prepare tiles for drawing. |
| 108 // - Runs client_->NotifyReadyToActivate() when all tiles required for | 110 // - Runs client_->NotifyReadyToActivate() when all tiles required for |
| 109 // activation are prepared, or failed to prepare due to OOM. | 111 // activation are prepared, or failed to prepare due to OOM. |
| 110 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are | 112 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are |
| 111 // prepared, or failed to prepare due to OOM. | 113 // prepared, or failed to prepare due to OOM. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 206 |
| 205 bool HasScheduledTileTasksForTesting() const { | 207 bool HasScheduledTileTasksForTesting() const { |
| 206 return has_scheduled_tile_tasks_; | 208 return has_scheduled_tile_tasks_; |
| 207 } | 209 } |
| 208 | 210 |
| 209 void OnRasterTaskCompleted(std::unique_ptr<RasterBuffer> raster_buffer, | 211 void OnRasterTaskCompleted(std::unique_ptr<RasterBuffer> raster_buffer, |
| 210 Tile* tile, | 212 Tile* tile, |
| 211 Resource* resource, | 213 Resource* resource, |
| 212 bool was_canceled); | 214 bool was_canceled); |
| 213 | 215 |
| 216 void SetDecodedImageTracker(DecodedImageTracker* decoded_image_tracker); |
| 217 |
| 214 protected: | 218 protected: |
| 215 void FreeResourcesForReleasedTiles(); | 219 void FreeResourcesForReleasedTiles(); |
| 216 void CleanUpReleasedTiles(); | 220 void CleanUpReleasedTiles(); |
| 217 | 221 |
| 218 friend class Tile; | 222 friend class Tile; |
| 219 // Virtual for testing. | 223 // Virtual for testing. |
| 220 virtual void Release(Tile* tile); | 224 virtual void Release(Tile* tile); |
| 221 Tile::Id GetUniqueTileId() { return ++next_tile_id_; } | 225 Tile::Id GetUniqueTileId() { return ++next_tile_id_; } |
| 222 | 226 |
| 223 private: | 227 private: |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 const bool check_tile_priority_inversion_; | 350 const bool check_tile_priority_inversion_; |
| 347 | 351 |
| 348 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 352 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
| 349 | 353 |
| 350 DISALLOW_COPY_AND_ASSIGN(TileManager); | 354 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 351 }; | 355 }; |
| 352 | 356 |
| 353 } // namespace cc | 357 } // namespace cc |
| 354 | 358 |
| 355 #endif // CC_TILES_TILE_MANAGER_H_ | 359 #endif // CC_TILES_TILE_MANAGER_H_ |
| OLD | NEW |