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" | |
25 #include "cc/tiles/eviction_tile_priority_queue.h" | 24 #include "cc/tiles/eviction_tile_priority_queue.h" |
26 #include "cc/tiles/image_controller.h" | 25 #include "cc/tiles/image_controller.h" |
27 #include "cc/tiles/raster_tile_priority_queue.h" | 26 #include "cc/tiles/raster_tile_priority_queue.h" |
28 #include "cc/tiles/tile.h" | 27 #include "cc/tiles/tile.h" |
29 #include "cc/tiles/tile_draw_info.h" | 28 #include "cc/tiles/tile_draw_info.h" |
30 #include "cc/tiles/tile_task_manager.h" | 29 #include "cc/tiles/tile_task_manager.h" |
31 | 30 |
32 namespace base { | 31 namespace base { |
33 namespace trace_event { | 32 namespace trace_event { |
34 class ConvertableToTraceFormat; | 33 class ConvertableToTraceFormat; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 91 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
93 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); | 92 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); |
94 | 93 |
95 // This class manages tiles, deciding which should get rasterized and which | 94 // This class manages tiles, deciding which should get rasterized and which |
96 // should no longer have any memory assigned to them. Tile objects are "owned" | 95 // should no longer have any memory assigned to them. Tile objects are "owned" |
97 // by layers; they automatically register with the manager when they are | 96 // by layers; they automatically register with the manager when they are |
98 // created, and unregister from the manager when they are deleted. | 97 // created, and unregister from the manager when they are deleted. |
99 class CC_EXPORT TileManager { | 98 class CC_EXPORT TileManager { |
100 public: | 99 public: |
101 TileManager(TileManagerClient* client, | 100 TileManager(TileManagerClient* client, |
102 base::SequencedTaskRunner* origin_task_runner, | 101 base::SequencedTaskRunner* task_runner, |
103 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner, | |
104 size_t scheduled_raster_task_limit, | 102 size_t scheduled_raster_task_limit, |
105 bool use_partial_raster, | 103 bool use_partial_raster, |
106 bool check_tile_priority_inversion); | 104 bool check_tile_priority_inversion); |
107 virtual ~TileManager(); | 105 virtual ~TileManager(); |
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. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 199 |
202 bool HasScheduledTileTasksForTesting() const { | 200 bool HasScheduledTileTasksForTesting() const { |
203 return has_scheduled_tile_tasks_; | 201 return has_scheduled_tile_tasks_; |
204 } | 202 } |
205 | 203 |
206 void OnRasterTaskCompleted(std::unique_ptr<RasterBuffer> raster_buffer, | 204 void OnRasterTaskCompleted(std::unique_ptr<RasterBuffer> raster_buffer, |
207 Tile::Id tile_id, | 205 Tile::Id tile_id, |
208 Resource* resource, | 206 Resource* resource, |
209 bool was_canceled); | 207 bool was_canceled); |
210 | 208 |
211 void SetDecodedImageTracker(DecodedImageTracker* decoded_image_tracker); | |
212 | |
213 protected: | 209 protected: |
214 friend class Tile; | 210 friend class Tile; |
215 // Must be called by tile during destruction. | 211 // Must be called by tile during destruction. |
216 void Release(Tile* tile); | 212 void Release(Tile* tile); |
217 Tile::Id GetUniqueTileId() { return ++next_tile_id_; } | 213 Tile::Id GetUniqueTileId() { return ++next_tile_id_; } |
218 | 214 |
219 private: | 215 private: |
220 class MemoryUsage { | 216 class MemoryUsage { |
221 public: | 217 public: |
222 MemoryUsage(); | 218 MemoryUsage(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 const bool check_tile_priority_inversion_; | 336 const bool check_tile_priority_inversion_; |
341 | 337 |
342 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 338 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
343 | 339 |
344 DISALLOW_COPY_AND_ASSIGN(TileManager); | 340 DISALLOW_COPY_AND_ASSIGN(TileManager); |
345 }; | 341 }; |
346 | 342 |
347 } // namespace cc | 343 } // namespace cc |
348 | 344 |
349 #endif // CC_TILES_TILE_MANAGER_H_ | 345 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |