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 const 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 std::vector<std::pair<DrawImage, scoped_refptr<TileTask>>> locked_images_; | 344 std::vector<std::pair<DrawImage, scoped_refptr<TileTask>>> locked_images_; |
341 | 345 |
342 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 346 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
343 | 347 |
344 DISALLOW_COPY_AND_ASSIGN(TileManager); | 348 DISALLOW_COPY_AND_ASSIGN(TileManager); |
345 }; | 349 }; |
346 | 350 |
347 } // namespace cc | 351 } // namespace cc |
348 | 352 |
349 #endif // CC_TILES_TILE_MANAGER_H_ | 353 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |