Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: cc/resources/raster_worker_pool.h

Issue 17351017: Re-land: cc: Add raster finished signals to RasterWorkerPool. (Closed) Base URL: http://git.chromium.org/chromium/src.git@new-graph-build
Patch Set: new approach Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool is_tile_in_pending_tree_now_bin; 98 bool is_tile_in_pending_tree_now_bin;
99 TileResolution tile_resolution; 99 TileResolution tile_resolution;
100 int layer_id; 100 int layer_id;
101 const void* tile_id; 101 const void* tile_id;
102 int source_frame_number; 102 int source_frame_number;
103 }; 103 };
104 104
105 class CC_EXPORT RasterWorkerPoolClient { 105 class CC_EXPORT RasterWorkerPoolClient {
106 public: 106 public:
107 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0; 107 virtual bool ShouldForceTasksRequiredForActivationToComplete() const = 0;
108 virtual void DidFinishedRunningTasks() = 0;
109 virtual void DidFinishedRunningTasksRequiredForActivation() = 0;
108 110
109 protected: 111 protected:
110 virtual ~RasterWorkerPoolClient() {} 112 virtual ~RasterWorkerPoolClient() {}
111 }; 113 };
112 114
113 // A worker thread pool that runs raster tasks. 115 // A worker thread pool that runs raster tasks.
114 class CC_EXPORT RasterWorkerPool : public WorkerPool { 116 class CC_EXPORT RasterWorkerPool : public WorkerPool {
115 public: 117 public:
116 class CC_EXPORT Task { 118 class CC_EXPORT Task {
117 public: 119 public:
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 const Task::Reply& reply); 227 const Task::Reply& reply);
226 228
227 protected: 229 protected:
228 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; 230 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector;
229 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> > 231 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> >
230 RasterTaskVector; 232 RasterTaskVector;
231 typedef internal::RasterWorkerPoolTask* TaskMapKey; 233 typedef internal::RasterWorkerPoolTask* TaskMapKey;
232 typedef base::hash_map<TaskMapKey, 234 typedef base::hash_map<TaskMapKey,
233 scoped_refptr<internal::WorkerPoolTask> > TaskMap; 235 scoped_refptr<internal::WorkerPoolTask> > TaskMap;
234 236
235 class CC_EXPORT RasterTaskGraph {
236 public:
237 RasterTaskGraph();
238 ~RasterTaskGraph();
239
240 void InsertRasterTask(internal::WorkerPoolTask* raster_task,
241 const TaskVector& decode_tasks);
242
243 private:
244 friend class RasterWorkerPool;
245
246 TaskGraph graph_;
247 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_;
248 scoped_ptr<GraphNode> raster_finished_node_;
249 unsigned next_priority_;
250
251 DISALLOW_COPY_AND_ASSIGN(RasterTaskGraph);
252 };
253
254 RasterWorkerPool(ResourceProvider* resource_provider, size_t num_threads); 237 RasterWorkerPool(ResourceProvider* resource_provider, size_t num_threads);
255 238
256 virtual void OnRasterTasksFinished() {}
257
258 void SetRasterTasks(RasterTask::Queue* queue); 239 void SetRasterTasks(RasterTask::Queue* queue);
259 void SetRasterTaskGraph(RasterTaskGraph* graph);
260 bool IsRasterTaskRequiredForActivation( 240 bool IsRasterTaskRequiredForActivation(
261 internal::RasterWorkerPoolTask* task) const; 241 internal::RasterWorkerPoolTask* task) const;
262 242
263 RasterWorkerPoolClient* client() const { return client_; } 243 RasterWorkerPoolClient* client() const { return client_; }
264 ResourceProvider* resource_provider() const { return resource_provider_; } 244 ResourceProvider* resource_provider() const { return resource_provider_; }
265 const RasterTask::Queue::TaskVector& raster_tasks() const { 245 const RasterTask::Queue::TaskVector& raster_tasks() const {
266 return raster_tasks_; 246 return raster_tasks_;
267 } 247 }
268 248
249 static scoped_ptr<GraphNode> CreateRasterTaskGraphNode(
250 internal::WorkerPoolTask* raster_task,
251 const TaskVector& decode_tasks,
252 unsigned priority,
253 TaskGraph* graph);
254
269 private: 255 private:
270 void OnRasterFinished(int64 schedule_raster_tasks_count);
271
272 RasterWorkerPoolClient* client_; 256 RasterWorkerPoolClient* client_;
273 ResourceProvider* resource_provider_; 257 ResourceProvider* resource_provider_;
274 RasterTask::Queue::TaskVector raster_tasks_; 258 RasterTask::Queue::TaskVector raster_tasks_;
275 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_; 259 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_;
276
277 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_;
278 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_;
279 int64 schedule_raster_tasks_count_;
280 }; 260 };
281 261
282 } // namespace cc 262 } // namespace cc
283 263
284 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ 264 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698