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

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

Issue 154003006: cc: Switch to vector based TaskGraph implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/pixel_buffer_raster_worker_pool.cc ('k') | cc/resources/raster_worker_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Force a check for completed tasks. 234 // Force a check for completed tasks.
235 virtual void CheckForCompletedTasks() = 0; 235 virtual void CheckForCompletedTasks() = 0;
236 236
237 // Returns the target that needs to be used for raster task resources. 237 // Returns the target that needs to be used for raster task resources.
238 virtual unsigned GetResourceTarget() const = 0; 238 virtual unsigned GetResourceTarget() const = 0;
239 239
240 // Returns the format that needs to be used for raster task resources. 240 // Returns the format that needs to be used for raster task resources.
241 virtual ResourceFormat GetResourceFormat() const = 0; 241 virtual ResourceFormat GetResourceFormat() const = 0;
242 242
243 protected: 243 protected:
244 typedef internal::TaskGraphRunner::TaskGraph TaskGraph;
245 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; 244 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector;
246 typedef std::deque<scoped_refptr<internal::WorkerPoolTask> > TaskDeque; 245 typedef std::deque<scoped_refptr<internal::WorkerPoolTask> > TaskDeque;
247 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> > 246 typedef std::vector<scoped_refptr<internal::RasterWorkerPoolTask> >
248 RasterTaskVector; 247 RasterTaskVector;
249 typedef base::hash_set<internal::RasterWorkerPoolTask*> RasterTaskSet; 248 typedef base::hash_set<internal::RasterWorkerPoolTask*> RasterTaskSet;
250 249
251 RasterWorkerPool(ResourceProvider* resource_provider, 250 RasterWorkerPool(ResourceProvider* resource_provider,
252 ContextProvider* context_provider); 251 ContextProvider* context_provider);
253 252
254 virtual void OnRasterTasksFinished() = 0; 253 virtual void OnRasterTasksFinished() = 0;
255 virtual void OnRasterTasksRequiredForActivationFinished() = 0; 254 virtual void OnRasterTasksRequiredForActivationFinished() = 0;
256 255
257 void SetRasterTasks(RasterTask::Queue* queue); 256 void SetRasterTasks(RasterTask::Queue* queue);
258 bool IsRasterTaskRequiredForActivation(internal::RasterWorkerPoolTask* task) 257 bool IsRasterTaskRequiredForActivation(internal::RasterWorkerPoolTask* task)
259 const; 258 const;
260 void SetTaskGraph(TaskGraph* graph); 259 void SetTaskGraph(internal::TaskGraph* graph);
261 void CollectCompletedWorkerPoolTasks(internal::Task::Vector* completed_tasks); 260 void CollectCompletedWorkerPoolTasks(internal::Task::Vector* completed_tasks);
262 261
263 // Run raster tasks that use GPU on current thread. 262 // Run raster tasks that use GPU on current thread.
264 void RunGpuRasterTasks(const RasterTaskVector& tasks); 263 void RunGpuRasterTasks(const RasterTaskVector& tasks);
265 void CheckForCompletedGpuRasterTasks(); 264 void CheckForCompletedGpuRasterTasks();
266 265
267 RasterWorkerPoolClient* client() const { return client_; } 266 RasterWorkerPoolClient* client() const { return client_; }
268 ResourceProvider* resource_provider() const { return resource_provider_; } 267 ResourceProvider* resource_provider() const { return resource_provider_; }
269 ContextProvider* context_provider() const { return context_provider_; } 268 ContextProvider* context_provider() const { return context_provider_; }
270 const RasterTaskVector& raster_tasks() const { return raster_tasks_; } 269 const RasterTaskVector& raster_tasks() const { return raster_tasks_; }
(...skipping 10 matching lines...) Expand all
281 raster_required_for_activation_finished_task; 280 raster_required_for_activation_finished_task;
282 } 281 }
283 282
284 scoped_refptr<internal::WorkerPoolTask> CreateRasterFinishedTask(); 283 scoped_refptr<internal::WorkerPoolTask> CreateRasterFinishedTask();
285 scoped_refptr<internal::WorkerPoolTask> 284 scoped_refptr<internal::WorkerPoolTask>
286 CreateRasterRequiredForActivationFinishedTask( 285 CreateRasterRequiredForActivationFinishedTask(
287 size_t tasks_required_for_activation_count); 286 size_t tasks_required_for_activation_count);
288 287
289 scoped_ptr<base::Value> ScheduledStateAsValue() const; 288 scoped_ptr<base::Value> ScheduledStateAsValue() const;
290 289
291 static internal::GraphNode* CreateGraphNodeForTask( 290 static void InsertNodeForTask(internal::TaskGraph* graph,
291 internal::WorkerPoolTask* task,
292 unsigned priority,
293 size_t dependencies);
294
295 static void InsertNodeForRasterTask(
296 internal::TaskGraph* graph,
292 internal::WorkerPoolTask* task, 297 internal::WorkerPoolTask* task,
293 unsigned priority, 298 const internal::Task::Vector& decode_tasks,
294 TaskGraph* graph); 299 unsigned priority);
295 300
296 static internal::GraphNode* CreateGraphNodeForRasterTask( 301 static unsigned kRasterFinishedTaskPriority;
297 internal::WorkerPoolTask* raster_task, 302 static unsigned kRasterRequiredForActivationFinishedTaskPriority;
298 const internal::Task::Vector& decode_tasks, 303 static unsigned kRasterTaskPriorityBase;
299 unsigned priority,
300 TaskGraph* graph);
301 304
302 private: 305 private:
303 void OnRasterFinished(const internal::WorkerPoolTask* source); 306 void OnRasterFinished(const internal::WorkerPoolTask* source);
304 void OnRasterRequiredForActivationFinished( 307 void OnRasterRequiredForActivationFinished(
305 const internal::WorkerPoolTask* source); 308 const internal::WorkerPoolTask* source);
306 309
307 internal::NamespaceToken namespace_token_; 310 internal::NamespaceToken namespace_token_;
308 RasterWorkerPoolClient* client_; 311 RasterWorkerPoolClient* client_;
309 ResourceProvider* resource_provider_; 312 ResourceProvider* resource_provider_;
310 ContextProvider* context_provider_; 313 ContextProvider* context_provider_;
311 RasterTask::Queue::TaskVector raster_tasks_; 314 RasterTask::Queue::TaskVector raster_tasks_;
312 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_; 315 RasterTask::Queue::TaskSet raster_tasks_required_for_activation_;
313 TaskDeque completed_gpu_raster_tasks_; 316 TaskDeque completed_gpu_raster_tasks_;
314 317
315 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_; 318 scoped_refptr<internal::WorkerPoolTask> raster_finished_task_;
316 scoped_refptr<internal::WorkerPoolTask> 319 scoped_refptr<internal::WorkerPoolTask>
317 raster_required_for_activation_finished_task_; 320 raster_required_for_activation_finished_task_;
318 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_; 321 base::WeakPtrFactory<RasterWorkerPool> weak_ptr_factory_;
319 }; 322 };
320 323
321 } // namespace cc 324 } // namespace cc
322 325
323 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ 326 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_
OLDNEW
« no previous file with comments | « cc/resources/pixel_buffer_raster_worker_pool.cc ('k') | cc/resources/raster_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698