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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 scoped_refptr<base::debug::ConvertableToTraceFormat> | 80 scoped_refptr<base::debug::ConvertableToTraceFormat> |
81 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); | 81 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); |
82 | 82 |
83 // This class manages tiles, deciding which should get rasterized and which | 83 // This class manages tiles, deciding which should get rasterized and which |
84 // should no longer have any memory assigned to them. Tile objects are "owned" | 84 // should no longer have any memory assigned to them. Tile objects are "owned" |
85 // by layers; they automatically register with the manager when they are | 85 // by layers; they automatically register with the manager when they are |
86 // created, and unregister from the manager when they are deleted. | 86 // created, and unregister from the manager when they are deleted. |
87 class CC_EXPORT TileManager : public RasterizerClient, | 87 class CC_EXPORT TileManager : public RasterizerClient, |
88 public RefCountedManager<Tile> { | 88 public RefCountedManager<Tile> { |
89 public: | 89 public: |
| 90 enum NamedTaskSet { |
| 91 REQUIRED_FOR_ACTIVATION = 0, |
| 92 HIGH_RESOLUTION_IN_NOW_BIN_ON_ACTIVE_TREE = 1, |
| 93 // Adding additional values required increasing kMaxTaskSet in rasterizer.h |
| 94 }; |
| 95 |
90 static scoped_ptr<TileManager> Create( | 96 static scoped_ptr<TileManager> Create( |
91 TileManagerClient* client, | 97 TileManagerClient* client, |
92 base::SequencedTaskRunner* task_runner, | 98 base::SequencedTaskRunner* task_runner, |
93 ResourcePool* resource_pool, | 99 ResourcePool* resource_pool, |
94 Rasterizer* rasterizer, | 100 Rasterizer* rasterizer, |
95 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 101 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
96 virtual ~TileManager(); | 102 virtual ~TileManager(); |
97 | 103 |
98 void ManageTiles(const GlobalStateThatImpactsTilePriority& state); | 104 void ManageTiles(const GlobalStateThatImpactsTilePriority& state); |
99 | 105 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 friend class Tile; | 174 friend class Tile; |
169 void DidChangeTilePriority(Tile* tile); | 175 void DidChangeTilePriority(Tile* tile); |
170 | 176 |
171 void FreeResourcesForReleasedTiles(); | 177 void FreeResourcesForReleasedTiles(); |
172 void CleanUpReleasedTiles(); | 178 void CleanUpReleasedTiles(); |
173 | 179 |
174 // Overriden from RefCountedManager<Tile>: | 180 // Overriden from RefCountedManager<Tile>: |
175 virtual void Release(Tile* tile) OVERRIDE; | 181 virtual void Release(Tile* tile) OVERRIDE; |
176 | 182 |
177 // Overriden from RasterizerClient: | 183 // Overriden from RasterizerClient: |
178 virtual bool ShouldForceTasksRequiredForActivationToComplete() const OVERRIDE; | |
179 virtual void DidFinishRunningTasks() OVERRIDE; | 184 virtual void DidFinishRunningTasks() OVERRIDE; |
180 virtual void DidFinishRunningTasksRequiredForActivation() OVERRIDE; | 185 virtual void DidFinishRunningTaskSet(TaskSet task_set) OVERRIDE; |
| 186 virtual bool ShouldForceTaskSetToComplete(TaskSet task_set) const OVERRIDE; |
| 187 virtual base::debug::TraceEventSyntheticDelay* SyntheticDelayForTaskSet( |
| 188 TaskSet task_set) const OVERRIDE; |
181 | 189 |
182 typedef std::vector<Tile*> TileVector; | 190 typedef std::vector<Tile*> TileVector; |
183 typedef std::set<Tile*> TileSet; | 191 typedef std::set<Tile*> TileSet; |
184 | 192 |
185 // Virtual for test | 193 // Virtual for test |
186 virtual void ScheduleTasks( | 194 virtual void ScheduleTasks( |
187 const TileVector& tiles_that_need_to_be_rasterized); | 195 const TileVector& tiles_that_need_to_be_rasterized); |
188 | 196 |
189 void AssignGpuMemoryToTiles(PrioritizedTileSet* tiles, | 197 void AssignGpuMemoryToTiles(PrioritizedTileSet* tiles, |
190 TileVector* tiles_that_need_to_be_rasterized); | 198 TileVector* tiles_that_need_to_be_rasterized); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 265 |
258 ResourceFormat resource_format_; | 266 ResourceFormat resource_format_; |
259 | 267 |
260 // Queue used when scheduling raster tasks. | 268 // Queue used when scheduling raster tasks. |
261 RasterTaskQueue raster_queue_; | 269 RasterTaskQueue raster_queue_; |
262 | 270 |
263 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; | 271 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; |
264 | 272 |
265 UniqueNotifier ready_to_activate_check_notifier_; | 273 UniqueNotifier ready_to_activate_check_notifier_; |
266 | 274 |
| 275 base::debug::TraceEventSyntheticDelay* |
| 276 raster_required_for_activation_synthetic_delay_; |
| 277 |
267 DISALLOW_COPY_AND_ASSIGN(TileManager); | 278 DISALLOW_COPY_AND_ASSIGN(TileManager); |
268 }; | 279 }; |
269 | 280 |
270 } // namespace cc | 281 } // namespace cc |
271 | 282 |
272 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 283 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |