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 HIGH_RESOLUTION_IN_NOW_BIN_ON_ACTIVE_TREE = 0, |
| 92 REQUIRED_FOR_ACTIVATION = 1, |
| 93 ALL = 2, |
| 94 // Adding additional values requires increasing kNumberOfTaskSets in |
| 95 // rasterizer.h |
| 96 }; |
| 97 |
90 static scoped_ptr<TileManager> Create( | 98 static scoped_ptr<TileManager> Create( |
91 TileManagerClient* client, | 99 TileManagerClient* client, |
92 base::SequencedTaskRunner* task_runner, | 100 base::SequencedTaskRunner* task_runner, |
93 ResourcePool* resource_pool, | 101 ResourcePool* resource_pool, |
94 Rasterizer* rasterizer, | 102 Rasterizer* rasterizer, |
95 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 103 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
96 virtual ~TileManager(); | 104 virtual ~TileManager(); |
97 | 105 |
98 void ManageTiles(const GlobalStateThatImpactsTilePriority& state); | 106 void ManageTiles(const GlobalStateThatImpactsTilePriority& state); |
99 | 107 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 friend class Tile; | 176 friend class Tile; |
169 void DidChangeTilePriority(Tile* tile); | 177 void DidChangeTilePriority(Tile* tile); |
170 | 178 |
171 void FreeResourcesForReleasedTiles(); | 179 void FreeResourcesForReleasedTiles(); |
172 void CleanUpReleasedTiles(); | 180 void CleanUpReleasedTiles(); |
173 | 181 |
174 // Overriden from RefCountedManager<Tile>: | 182 // Overriden from RefCountedManager<Tile>: |
175 virtual void Release(Tile* tile) OVERRIDE; | 183 virtual void Release(Tile* tile) OVERRIDE; |
176 | 184 |
177 // Overriden from RasterizerClient: | 185 // Overriden from RasterizerClient: |
178 virtual bool ShouldForceTasksRequiredForActivationToComplete() const OVERRIDE; | 186 virtual void DidFinishRunningTaskSet(TaskSet task_set) OVERRIDE; |
179 virtual void DidFinishRunningTasks() OVERRIDE; | 187 virtual TaskSetCollection TasksThatShouldBeForcedToComplete() const OVERRIDE; |
180 virtual void DidFinishRunningTasksRequiredForActivation() OVERRIDE; | 188 virtual base::debug::TraceEventSyntheticDelay* SyntheticDelayForTaskSet( |
| 189 TaskSet task_set) const OVERRIDE; |
181 | 190 |
182 typedef std::vector<Tile*> TileVector; | 191 typedef std::vector<Tile*> TileVector; |
183 typedef std::set<Tile*> TileSet; | 192 typedef std::set<Tile*> TileSet; |
184 | 193 |
185 // Virtual for test | 194 // Virtual for test |
186 virtual void ScheduleTasks( | 195 virtual void ScheduleTasks( |
187 const TileVector& tiles_that_need_to_be_rasterized); | 196 const TileVector& tiles_that_need_to_be_rasterized); |
188 | 197 |
189 void AssignGpuMemoryToTiles(PrioritizedTileSet* tiles, | 198 void AssignGpuMemoryToTiles(PrioritizedTileSet* tiles, |
190 TileVector* tiles_that_need_to_be_rasterized); | 199 TileVector* tiles_that_need_to_be_rasterized); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 266 |
258 ResourceFormat resource_format_; | 267 ResourceFormat resource_format_; |
259 | 268 |
260 // Queue used when scheduling raster tasks. | 269 // Queue used when scheduling raster tasks. |
261 RasterTaskQueue raster_queue_; | 270 RasterTaskQueue raster_queue_; |
262 | 271 |
263 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; | 272 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; |
264 | 273 |
265 UniqueNotifier ready_to_activate_check_notifier_; | 274 UniqueNotifier ready_to_activate_check_notifier_; |
266 | 275 |
| 276 base::debug::TraceEventSyntheticDelay* |
| 277 raster_required_for_activation_synthetic_delay_; |
| 278 |
267 DISALLOW_COPY_AND_ASSIGN(TileManager); | 279 DISALLOW_COPY_AND_ASSIGN(TileManager); |
268 }; | 280 }; |
269 | 281 |
270 } // namespace cc | 282 } // namespace cc |
271 | 283 |
272 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 284 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |