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 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // queue that will return tiles in order in which they should be evicted. | 69 // queue that will return tiles in order in which they should be evicted. |
70 // Note if the queue was previous built, Reset must be called on it. | 70 // Note if the queue was previous built, Reset must be called on it. |
71 virtual std::unique_ptr<EvictionTilePriorityQueue> BuildEvictionQueue( | 71 virtual std::unique_ptr<EvictionTilePriorityQueue> BuildEvictionQueue( |
72 TreePriority tree_priority) = 0; | 72 TreePriority tree_priority) = 0; |
73 | 73 |
74 // Informs the client that due to the currently rasterizing (or scheduled to | 74 // Informs the client that due to the currently rasterizing (or scheduled to |
75 // be rasterized) tiles, we will be in a position that will likely require a | 75 // be rasterized) tiles, we will be in a position that will likely require a |
76 // draw. This can be used to preemptively start a frame. | 76 // draw. This can be used to preemptively start a frame. |
77 virtual void SetIsLikelyToRequireADraw(bool is_likely_to_require_a_draw) = 0; | 77 virtual void SetIsLikelyToRequireADraw(bool is_likely_to_require_a_draw) = 0; |
78 | 78 |
| 79 // Requests the color space into which tiles should be rasterized. |
| 80 virtual gfx::ColorSpace GetTileColorSpace() const = 0; |
| 81 |
79 protected: | 82 protected: |
80 virtual ~TileManagerClient() {} | 83 virtual ~TileManagerClient() {} |
81 }; | 84 }; |
82 | 85 |
83 struct RasterTaskCompletionStats { | 86 struct RasterTaskCompletionStats { |
84 RasterTaskCompletionStats(); | 87 RasterTaskCompletionStats(); |
85 | 88 |
86 size_t completed_count; | 89 size_t completed_count; |
87 size_t canceled_count; | 90 size_t canceled_count; |
88 }; | 91 }; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 144 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
142 return memory_stats_from_last_assign_; | 145 return memory_stats_from_last_assign_; |
143 } | 146 } |
144 | 147 |
145 // Public methods for testing. | 148 // Public methods for testing. |
146 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { | 149 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { |
147 for (size_t i = 0; i < tiles.size(); ++i) { | 150 for (size_t i = 0; i < tiles.size(); ++i) { |
148 TileDrawInfo& draw_info = tiles[i]->draw_info(); | 151 TileDrawInfo& draw_info = tiles[i]->draw_info(); |
149 draw_info.resource_ = resource_pool_->AcquireResource( | 152 draw_info.resource_ = resource_pool_->AcquireResource( |
150 tiles[i]->desired_texture_size(), | 153 tiles[i]->desired_texture_size(), |
151 raster_buffer_provider_->GetResourceFormat(false), gfx::ColorSpace()); | 154 raster_buffer_provider_->GetResourceFormat(false), |
| 155 client_->GetTileColorSpace()); |
152 } | 156 } |
153 } | 157 } |
154 | 158 |
155 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { | 159 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { |
156 for (size_t i = 0; i < tiles.size(); ++i) { | 160 for (size_t i = 0; i < tiles.size(); ++i) { |
157 Tile* tile = tiles[i]; | 161 Tile* tile = tiles[i]; |
158 FreeResourcesForTile(tile); | 162 FreeResourcesForTile(tile); |
159 } | 163 } |
160 } | 164 } |
161 | 165 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 PrioritizedWorkToSchedule(PrioritizedWorkToSchedule&& other); | 254 PrioritizedWorkToSchedule(PrioritizedWorkToSchedule&& other); |
251 ~PrioritizedWorkToSchedule(); | 255 ~PrioritizedWorkToSchedule(); |
252 | 256 |
253 std::vector<PrioritizedTile> tiles_to_raster; | 257 std::vector<PrioritizedTile> tiles_to_raster; |
254 std::vector<PrioritizedTile> tiles_to_process_for_images; | 258 std::vector<PrioritizedTile> tiles_to_process_for_images; |
255 }; | 259 }; |
256 | 260 |
257 void FreeResourcesForTile(Tile* tile); | 261 void FreeResourcesForTile(Tile* tile); |
258 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); | 262 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); |
259 scoped_refptr<TileTask> CreateRasterTask( | 263 scoped_refptr<TileTask> CreateRasterTask( |
260 const PrioritizedTile& prioritized_tile); | 264 const PrioritizedTile& prioritized_tile, |
| 265 const gfx::ColorSpace& color_space); |
261 | 266 |
262 std::unique_ptr<EvictionTilePriorityQueue> | 267 std::unique_ptr<EvictionTilePriorityQueue> |
263 FreeTileResourcesUntilUsageIsWithinLimit( | 268 FreeTileResourcesUntilUsageIsWithinLimit( |
264 std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 269 std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
265 const MemoryUsage& limit, | 270 const MemoryUsage& limit, |
266 MemoryUsage* usage); | 271 MemoryUsage* usage); |
267 std::unique_ptr<EvictionTilePriorityQueue> | 272 std::unique_ptr<EvictionTilePriorityQueue> |
268 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( | 273 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( |
269 std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 274 std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
270 const MemoryUsage& limit, | 275 const MemoryUsage& limit, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 std::vector<std::pair<DrawImage, scoped_refptr<TileTask>>> locked_images_; | 345 std::vector<std::pair<DrawImage, scoped_refptr<TileTask>>> locked_images_; |
341 | 346 |
342 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 347 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
343 | 348 |
344 DISALLOW_COPY_AND_ASSIGN(TileManager); | 349 DISALLOW_COPY_AND_ASSIGN(TileManager); |
345 }; | 350 }; |
346 | 351 |
347 } // namespace cc | 352 } // namespace cc |
348 | 353 |
349 #endif // CC_TILES_TILE_MANAGER_H_ | 354 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |