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

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

Issue 523243002: cc: Generalize raster task notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 "cc/resources/rasterizer.h" 8 #include "cc/resources/rasterizer.h"
9 9
10 namespace base { 10 namespace base {
11 class SequencedTaskRunner; 11 class SequencedTaskRunner;
12 } 12 }
13 13
14 namespace cc { 14 namespace cc {
15 15
16 class CC_EXPORT RasterWorkerPool { 16 class CC_EXPORT RasterWorkerPool {
17 public: 17 public:
18 static unsigned kOnDemandRasterTaskPriority; 18 static unsigned kOnDemandRasterTaskPriority;
19 static unsigned kBenchmarkRasterTaskPriority; 19 static unsigned kBenchmarkRasterTaskPriority;
20 static unsigned kRasterFinishedTaskPriority; 20 static unsigned kRasterFinishedTaskPriority;
21 static unsigned kRasterRequiredForActivationFinishedTaskPriority; 21 static unsigned kRasterRequiredForActivationFinishedTaskPriority;
reveman 2014/09/05 08:38:59 don't need this anymore
ernstm 2014/09/05 21:36:11 Done.
22 static unsigned kRasterTaskSetFinishedTaskPriority;
22 static unsigned kRasterTaskPriorityBase; 23 static unsigned kRasterTaskPriorityBase;
23 24
24 RasterWorkerPool(); 25 RasterWorkerPool();
25 virtual ~RasterWorkerPool(); 26 virtual ~RasterWorkerPool();
26 27
27 // Set the number of threads to use for the global TaskGraphRunner instance. 28 // Set the number of threads to use for the global TaskGraphRunner instance.
28 // This can only be called once and must be called prior to 29 // This can only be called once and must be called prior to
29 // GetNumRasterThreads(). 30 // GetNumRasterThreads().
30 static void SetNumRasterThreads(int num_threads); 31 static void SetNumRasterThreads(int num_threads);
31 32
32 // Returns the number of threads used for the global TaskGraphRunner instance. 33 // Returns the number of threads used for the global TaskGraphRunner instance.
33 static int GetNumRasterThreads(); 34 static int GetNumRasterThreads();
34 35
35 // Returns a pointer to the global TaskGraphRunner instance. 36 // Returns a pointer to the global TaskGraphRunner instance.
36 static TaskGraphRunner* GetTaskGraphRunner(); 37 static TaskGraphRunner* GetTaskGraphRunner();
37 38
38 // Utility function that can be used to create a "raster finished" task that 39 // Utility function that can be used to create a "raster finished" task that
39 // posts |callback| to |task_runner| when run. 40 // posts |callback| to |task_runner| when run.
40 static scoped_refptr<RasterizerTask> CreateRasterFinishedTask( 41 static scoped_refptr<RasterizerTask> CreateRasterFinishedTask(
41 base::SequencedTaskRunner* task_runner, 42 base::SequencedTaskRunner* task_runner,
42 const base::Closure& callback); 43 const base::Closure& callback,
43 44 base::debug::TraceEventSyntheticDelay* synthetic_delay);
44 // Utility function that can be used to create a "raster required for
45 // activation finished" task that posts |callback| to |task_runner| when run.
46 static scoped_refptr<RasterizerTask>
47 CreateRasterRequiredForActivationFinishedTask(
48 size_t tasks_required_for_activation_count,
49 base::SequencedTaskRunner* task_runner,
50 const base::Closure& callback);
51 45
52 // Utility function that can be used to call ::ScheduleOnOriginThread() for 46 // Utility function that can be used to call ::ScheduleOnOriginThread() for
53 // each task in |graph|. 47 // each task in |graph|.
54 static void ScheduleTasksOnOriginThread(RasterizerTaskClient* client, 48 static void ScheduleTasksOnOriginThread(RasterizerTaskClient* client,
55 TaskGraph* graph); 49 TaskGraph* graph);
56 50
57 // Utility function that can be used to build a task graph. Inserts a node 51 // Utility function that can be used to build a task graph. Inserts a node
58 // that represents |task| in |graph|. See TaskGraph definition for valid 52 // that represents |task| in |graph|. See TaskGraph definition for valid
59 // |priority| values. 53 // |priority| values.
60 static void InsertNodeForTask(TaskGraph* graph, 54 static void InsertNodeForTask(TaskGraph* graph,
61 RasterizerTask* task, 55 RasterizerTask* task,
62 unsigned priority, 56 unsigned priority,
63 size_t dependencies); 57 size_t dependencies);
64 58
65 // Utility function that can be used to build a task graph. Inserts nodes that 59 // Utility function that can be used to build a task graph. Inserts nodes that
66 // represent |task| and all its image decode dependencies in |graph|. 60 // represent |task| and all its image decode dependencies in |graph|.
67 static void InsertNodesForRasterTask( 61 static void InsertNodesForRasterTask(
68 TaskGraph* graph, 62 TaskGraph* graph,
69 RasterTask* task, 63 RasterTask* task,
70 const ImageDecodeTask::Vector& decode_tasks, 64 const ImageDecodeTask::Vector& decode_tasks,
71 unsigned priority); 65 unsigned priority);
72 66
73 // Type-checking downcast routine. 67 // Type-checking downcast routine.
74 virtual Rasterizer* AsRasterizer() = 0; 68 virtual Rasterizer* AsRasterizer() = 0;
75 }; 69 };
76 70
77 } // namespace cc 71 } // namespace cc
78 72
79 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_ 73 #endif // CC_RESOURCES_RASTER_WORKER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698