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

Side by Side Diff: cc/raster/task_graph_runner.h

Issue 1489233003: TaskGraphRunner Group support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor
Patch Set: feedback Created 5 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_RASTER_TASK_GRAPH_RUNNER_H_ 5 #ifndef CC_RASTER_TASK_GRAPH_RUNNER_H_
6 #define CC_RASTER_TASK_GRAPH_RUNNER_H_ 6 #define CC_RASTER_TASK_GRAPH_RUNNER_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 39
40 Task(); 40 Task();
41 virtual ~Task(); 41 virtual ~Task();
42 42
43 bool will_run_; 43 bool will_run_;
44 bool did_run_; 44 bool did_run_;
45 }; 45 };
46 46
47 // A task dependency graph describes the order in which to execute a set 47 // A task dependency graph describes the order in which to execute a set
48 // of tasks. Dependencies are represented as edges. Each node is assigned 48 // of tasks. Dependencies are represented as edges. Each node is assigned
49 // a priority and a run count that matches the number of dependencies. 49 // a category, a priority and a run count that matches the number of
50 // Priority range from 0 (most favorable scheduling) to UINT_MAX 50 // dependencies. Priority range from 0 (most favorable scheduling) to UINT16_MAX
51 // (least favorable). 51 // (least favorable). Categories range from 0 to UINT16_MAX. It is up to the
52 // implementation and its consumer to determine the meaning (if any) of a
53 // category. A TaskGraphRunner implementation may chose to prioritize certain
54 // categories over others, regardless of the individual priorities of tasks.
52 struct CC_EXPORT TaskGraph { 55 struct CC_EXPORT TaskGraph {
53 struct Node { 56 struct Node {
54 typedef std::vector<Node> Vector; 57 typedef std::vector<Node> Vector;
55 58
56 Node(Task* task, size_t priority, size_t dependencies) 59 Node(Task* task, uint16_t category, uint16_t priority, size_t dependencies)
57 : task(task), priority(priority), dependencies(dependencies) {} 60 : task(task),
61 category(category),
62 priority(priority),
63 dependencies(dependencies) {}
58 64
59 Task* task; 65 Task* task;
60 size_t priority; 66 uint16_t category;
61 size_t dependencies; 67 uint16_t priority;
68 uint32_t dependencies;
62 }; 69 };
63 70
64 struct Edge { 71 struct Edge {
65 typedef std::vector<Edge> Vector; 72 typedef std::vector<Edge> Vector;
66 73
67 Edge(const Task* task, Task* dependent) 74 Edge(const Task* task, Task* dependent)
68 : task(task), dependent(dependent) {} 75 : task(task), dependent(dependent) {}
69 76
70 const Task* task; 77 const Task* task;
71 Task* dependent; 78 Task* dependent;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 private: 210 private:
204 TaskGraph* graph_; 211 TaskGraph* graph_;
205 const Task* task_; 212 const Task* task_;
206 size_t current_index_; 213 size_t current_index_;
207 TaskGraph::Node* current_node_; 214 TaskGraph::Node* current_node_;
208 }; 215 };
209 216
210 } // namespace cc 217 } // namespace cc
211 218
212 #endif // CC_RASTER_TASK_GRAPH_RUNNER_H_ 219 #endif // CC_RASTER_TASK_GRAPH_RUNNER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698