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

Unified Diff: cc/resources/worker_pool.h

Issue 17244003: cc: Move task graph construction to RasterWorkerPool classes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@wp-run-count
Patch Set: add missing CC_EXPORT Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/tile_manager.cc ('k') | cc/resources/worker_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/worker_pool.h
diff --git a/cc/resources/worker_pool.h b/cc/resources/worker_pool.h
index cfa6302f91daa99b0ed5822d71800f0eedd3b0a6..a8f27db5f4354b2d94f246c947f53fd359ac897a 100644
--- a/cc/resources/worker_pool.h
+++ b/cc/resources/worker_pool.h
@@ -23,8 +23,6 @@ namespace internal {
class CC_EXPORT WorkerPoolTask
: public base::RefCountedThreadSafe<WorkerPoolTask> {
public:
- typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector;
-
virtual void RunOnThread(unsigned thread_index) = 0;
virtual void DispatchCompletionCallback() = 0;
@@ -36,20 +34,16 @@ class CC_EXPORT WorkerPoolTask
bool HasFinishedRunning() const;
bool HasCompleted() const;
- TaskVector& dependencies() { return dependencies_; }
-
protected:
friend class base::RefCountedThreadSafe<WorkerPoolTask>;
WorkerPoolTask();
- explicit WorkerPoolTask(TaskVector* dependencies);
virtual ~WorkerPoolTask();
private:
bool did_schedule_;
bool did_run_;
bool did_complete_;
- TaskVector dependencies_;
};
} // namespace internal
@@ -85,12 +79,14 @@ class CC_EXPORT WorkerPool {
public:
typedef std::vector<GraphNode*> Vector;
- explicit GraphNode(internal::WorkerPoolTask* task);
+ GraphNode();
~GraphNode();
+ void set_task(internal::WorkerPoolTask* task) { task_ = task; }
internal::WorkerPoolTask* task() { return task_; }
void add_dependent(GraphNode* dependent) {
+ DCHECK(dependent);
dependents_.push_back(dependent);
}
const Vector& dependents() const {
@@ -117,6 +113,10 @@ class CC_EXPORT WorkerPool {
DISALLOW_COPY_AND_ASSIGN(GraphNode);
};
+ // A task graph contains a unique set of tasks with edges between
+ // dependencies pointing in the direction of the dependents. Each task
+ // need to be assigned a unique priority and a run count that matches
+ // the number of dependencies.
typedef ScopedPtrHashMap<internal::WorkerPoolTask*, GraphNode> GraphNodeMap;
typedef GraphNodeMap TaskGraph;
@@ -127,31 +127,6 @@ class CC_EXPORT WorkerPool {
// but completion of them is still processed.
void SetTaskGraph(TaskGraph* graph);
- // BuildTaskGraph() takes a task tree as input and constructs a
- // unique set of tasks with edges between dependencies pointing in
- // the direction of the dependents. Each task is given a unique priority
- // which is currently the same as the DFS traversal order.
- //
- // Input: Output:
- //
- // root task4 Task | Priority (lower is better)
- // / \ / \ -------+---------------------------
- // task1 task2 task3 task2 root | 4
- // | | | | task1 | 2
- // task3 | task1 | task2 | 3
- // | | \ / task3 | 1
- // task4 task4 root task4 | 0
- //
- // The output can be used to efficiently maintain a queue of
- // "ready to run" tasks.
- static unsigned BuildTaskGraphRecursive(
- internal::WorkerPoolTask* task,
- GraphNode* dependent,
- unsigned priority,
- TaskGraph* graph);
- static void BuildTaskGraph(
- internal::WorkerPoolTask* root, TaskGraph* graph);
-
private:
class Inner;
friend class Inner;
« no previous file with comments | « cc/resources/tile_manager.cc ('k') | cc/resources/worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698