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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 201 |
200 bool HasScheduledTileTasksForTesting() const { | 202 bool HasScheduledTileTasksForTesting() const { |
201 return has_scheduled_tile_tasks_; | 203 return has_scheduled_tile_tasks_; |
202 } | 204 } |
203 | 205 |
204 void OnRasterTaskCompleted(std::unique_ptr<RasterBuffer> raster_buffer, | 206 void OnRasterTaskCompleted(std::unique_ptr<RasterBuffer> raster_buffer, |
205 Tile::Id tile_id, | 207 Tile::Id tile_id, |
206 Resource* resource, | 208 Resource* resource, |
207 bool was_canceled); | 209 bool was_canceled); |
208 | 210 |
| 211 void SetDecodedImageTracker(DecodedImageTracker* decoded_image_tracker); |
| 212 |
209 protected: | 213 protected: |
210 friend class Tile; | 214 friend class Tile; |
211 // Must be called by tile during destruction. | 215 // Must be called by tile during destruction. |
212 void Release(Tile* tile); | 216 void Release(Tile* tile); |
213 Tile::Id GetUniqueTileId() { return ++next_tile_id_; } | 217 Tile::Id GetUniqueTileId() { return ++next_tile_id_; } |
214 | 218 |
215 private: | 219 private: |
216 class MemoryUsage { | 220 class MemoryUsage { |
217 public: | 221 public: |
218 MemoryUsage(); | 222 MemoryUsage(); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 const bool check_tile_priority_inversion_; | 340 const bool check_tile_priority_inversion_; |
337 | 341 |
338 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 342 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
339 | 343 |
340 DISALLOW_COPY_AND_ASSIGN(TileManager); | 344 DISALLOW_COPY_AND_ASSIGN(TileManager); |
341 }; | 345 }; |
342 | 346 |
343 } // namespace cc | 347 } // namespace cc |
344 | 348 |
345 #endif // CC_TILES_TILE_MANAGER_H_ | 349 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |