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