OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RASTER_WORKER_POOL_H_ | 5 #ifndef CC_RESOURCES_RASTER_WORKER_POOL_H_ |
6 #define CC_RESOURCES_RASTER_WORKER_POOL_H_ | 6 #define CC_RESOURCES_RASTER_WORKER_POOL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 bool is_tile_in_pending_tree_now_bin; | 95 bool is_tile_in_pending_tree_now_bin; |
96 TileResolution tile_resolution; | 96 TileResolution tile_resolution; |
97 int layer_id; | 97 int layer_id; |
98 const void* tile_id; | 98 const void* tile_id; |
99 int source_frame_number; | 99 int source_frame_number; |
100 }; | 100 }; |
101 | 101 |
102 class CC_EXPORT RasterWorkerPoolClient { | 102 class CC_EXPORT RasterWorkerPoolClient { |
103 public: | 103 public: |
104 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0; | 104 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0; |
| 105 virtual void DidFinishedRunningTasks() = 0; |
| 106 virtual void DidFinishedRunningTasksRequiredForActivation() = 0; |
105 | 107 |
106 protected: | 108 protected: |
107 virtual ~RasterWorkerPoolClient() {} | 109 virtual ~RasterWorkerPoolClient() {} |
108 }; | 110 }; |
109 | 111 |
110 // A worker thread pool that runs raster tasks. | 112 // A worker thread pool that runs raster tasks. |
111 class CC_EXPORT RasterWorkerPool : public WorkerPool { | 113 class CC_EXPORT RasterWorkerPool : public WorkerPool { |
112 public: | 114 public: |
113 class CC_EXPORT Task { | 115 class CC_EXPORT Task { |
114 public: | 116 public: |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 typedef internal::RasterWorkerPoolTask* TaskMapKey; | 230 typedef internal::RasterWorkerPoolTask* TaskMapKey; |
229 typedef base::hash_map<TaskMapKey, | 231 typedef base::hash_map<TaskMapKey, |
230 scoped_refptr<internal::WorkerPoolTask> > TaskMap; | 232 scoped_refptr<internal::WorkerPoolTask> > TaskMap; |
231 | 233 |
232 class CC_EXPORT RasterTaskGraph { | 234 class CC_EXPORT RasterTaskGraph { |
233 public: | 235 public: |
234 RasterTaskGraph(); | 236 RasterTaskGraph(); |
235 ~RasterTaskGraph(); | 237 ~RasterTaskGraph(); |
236 | 238 |
237 void InsertRasterTask(internal::WorkerPoolTask* raster_task, | 239 void InsertRasterTask(internal::WorkerPoolTask* raster_task, |
238 const TaskVector& decode_tasks); | 240 const TaskVector& decode_tasks, |
| 241 bool required_for_activation); |
239 | 242 |
240 private: | 243 private: |
241 friend class RasterWorkerPool; | 244 friend class RasterWorkerPool; |
242 | 245 |
243 TaskGraph graph_; | 246 TaskGraph graph_; |
244 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; | |
245 scoped_ptr<GraphNode> raster_finished_node_; | 247 scoped_ptr<GraphNode> raster_finished_node_; |
| 248 scoped_ptr<GraphNode> raster_required_for_activation_finished_node_; |
246 unsigned next_priority_; | 249 unsigned next_priority_; |
247 | 250 |
248 DISALLOW_COPY_AND_ASSIGN(RasterTaskGraph); | 251 DISALLOW_COPY_AND_ASSIGN(RasterTaskGraph); |
249 }; | 252 }; |
250 | 253 |
251 RasterWorkerPool(ResourceProvider* resource_provider, size_t num_threads); | 254 RasterWorkerPool(ResourceProvider* resource_provider, size_t num_threads); |
252 | 255 |
253 virtual void OnRasterTasksFinished() {} | 256 virtual void OnRasterTasksFinished() = 0; |
| 257 virtual void OnRasterTasksRequiredForActivationFinished() = 0; |
254 | 258 |
255 void SetRasterTasks(RasterTask::Queue* queue); | 259 void SetRasterTasks(RasterTask::Queue* queue); |
256 void SetRasterTaskGraph(RasterTaskGraph* graph); | 260 void SetRasterTaskGraph(RasterTaskGraph* graph); |
257 bool IsRasterTaskRequiredForActivation( | 261 bool IsRasterTaskRequiredForActivation( |
258 internal::RasterWorkerPoolTask* task) const; | 262 internal::RasterWorkerPoolTask* task) const; |
259 | 263 |
260 RasterWorkerPoolClient* client() const { return client_; } | 264 RasterWorkerPoolClient* client() const { return client_; } |
261 ResourceProvider* resource_provider() const { return resource_provider_; } | 265 ResourceProvider* resource_provider() const { return resource_provider_; } |
262 const RasterTask::Queue::TaskVector& raster_tasks() const { | 266 const RasterTask::Queue::TaskVector& raster_tasks() const { |
263 return raster_tasks_; | 267 return raster_tasks_; |
264 } | 268 } |
265 | 269 |
266 private: | 270 private: |
267 void OnRasterFinished(int64 schedule_raster_tasks_count); | 271 void OnRasterFinished(int64 schedule_raster_tasks_count); |
| 272 void OnRasterRequiredForActivationFinished( |
| 273 int64 schedule_raster_tasks_count); |
268 | 274 |
269 RasterWorkerPoolClient* client_; | 275 RasterWorkerPoolClient* client_; |
270 ResourceProvider* resource_provider_; | 276 ResourceProvider* resource_provider_; |
271 RasterTask::Queue::TaskVector raster_tasks_; | 277 RasterTask::Queue::TaskVector raster_tasks_; |
272 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_; | 278 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_; |
273 | 279 |
274 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; | 280 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; |
275 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; | 281 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; |
| 282 scoped_refptr<internal::WorkerPoolTask> |
| 283 raster_required_for_activation_finished_task_; |
276 int64 schedule_raster_tasks_count_; | 284 int64 schedule_raster_tasks_count_; |
277 }; | 285 }; |
278 | 286 |
279 } // namespace cc | 287 } // namespace cc |
280 | 288 |
281 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ | 289 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ |
OLD | NEW |