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_RESOURCES_TILE_MANAGER_H_ | 5 #ifndef CC_RESOURCES_TILE_MANAGER_H_ |
6 #define CC_RESOURCES_TILE_MANAGER_H_ | 6 #define CC_RESOURCES_TILE_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void UpdateVisibleTiles(const GlobalStateThatImpactsTilePriority& state); | 121 void UpdateVisibleTiles(const GlobalStateThatImpactsTilePriority& state); |
122 | 122 |
123 scoped_refptr<Tile> CreateTile(RasterSource* raster_source, | 123 scoped_refptr<Tile> CreateTile(RasterSource* raster_source, |
124 const gfx::Size& desired_texture_size, | 124 const gfx::Size& desired_texture_size, |
125 const gfx::Rect& content_rect, | 125 const gfx::Rect& content_rect, |
126 float contents_scale, | 126 float contents_scale, |
127 int layer_id, | 127 int layer_id, |
128 int source_frame_number, | 128 int source_frame_number, |
129 int flags); | 129 int flags); |
130 | 130 |
| 131 bool IsReadyToActivate() const; |
| 132 bool IsReadyToDraw() const; |
| 133 |
131 scoped_refptr<base::trace_event::ConvertableToTraceFormat> BasicStateAsValue() | 134 scoped_refptr<base::trace_event::ConvertableToTraceFormat> BasicStateAsValue() |
132 const; | 135 const; |
133 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const; | 136 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const; |
134 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 137 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
135 return memory_stats_from_last_assign_; | 138 return memory_stats_from_last_assign_; |
136 } | 139 } |
137 | 140 |
| 141 // Public methods for testing. |
138 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { | 142 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { |
139 for (size_t i = 0; i < tiles.size(); ++i) { | 143 for (size_t i = 0; i < tiles.size(); ++i) { |
140 TileDrawInfo& draw_info = tiles[i]->draw_info(); | 144 TileDrawInfo& draw_info = tiles[i]->draw_info(); |
141 draw_info.resource_ = resource_pool_->AcquireResource( | 145 draw_info.resource_ = resource_pool_->AcquireResource( |
142 tiles[i]->desired_texture_size(), | 146 tiles[i]->desired_texture_size(), |
143 tile_task_runner_->GetResourceFormat()); | 147 tile_task_runner_->GetResourceFormat()); |
144 } | 148 } |
145 } | 149 } |
146 | 150 |
147 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { | 151 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { |
(...skipping 21 matching lines...) Expand all Loading... |
169 ++it) { | 173 ++it) { |
170 tiles.push_back(it->second); | 174 tiles.push_back(it->second); |
171 } | 175 } |
172 return tiles; | 176 return tiles; |
173 } | 177 } |
174 | 178 |
175 void SetScheduledRasterTaskLimitForTesting(size_t limit) { | 179 void SetScheduledRasterTaskLimitForTesting(size_t limit) { |
176 scheduled_raster_task_limit_ = limit; | 180 scheduled_raster_task_limit_ = limit; |
177 } | 181 } |
178 | 182 |
179 bool IsReadyToActivate() const; | 183 void CheckIfMoreTilesNeedToBePreparedForTesting() { |
180 bool IsReadyToDraw() const; | 184 CheckIfMoreTilesNeedToBePrepared(); |
| 185 } |
181 | 186 |
182 protected: | 187 protected: |
183 TileManager(TileManagerClient* client, | 188 TileManager(TileManagerClient* client, |
184 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 189 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
185 ResourcePool* resource_pool, | 190 ResourcePool* resource_pool, |
186 TileTaskRunner* tile_task_runner, | 191 TileTaskRunner* tile_task_runner, |
187 Rasterizer* rasterizer, | 192 Rasterizer* rasterizer, |
188 size_t scheduled_raster_task_limit); | 193 size_t scheduled_raster_task_limit); |
189 | 194 |
190 void FreeResourcesForReleasedTiles(); | 195 void FreeResourcesForReleasedTiles(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 316 |
312 bool did_notify_ready_to_activate_; | 317 bool did_notify_ready_to_activate_; |
313 bool did_notify_ready_to_draw_; | 318 bool did_notify_ready_to_draw_; |
314 | 319 |
315 DISALLOW_COPY_AND_ASSIGN(TileManager); | 320 DISALLOW_COPY_AND_ASSIGN(TileManager); |
316 }; | 321 }; |
317 | 322 |
318 } // namespace cc | 323 } // namespace cc |
319 | 324 |
320 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 325 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |