Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 group, a priority and a run count that matches the number of dependencies. |
|
reveman
2015/12/04 02:30:53
how do you feel about "category" instead of "group
ericrk
2015/12/04 19:14:30
hmm, either seems fine to me, I'll switch to categ
| |
| 50 // Priority range from 0 (most favorable scheduling) to UINT_MAX | 50 // Priority range from 0 (most favorable scheduling) to UINT16_MAX |
| 51 // (least favorable). | 51 // (least favorable). Groups range from 0 to UINT16_MAX. It is up to the |
| 52 // implementation and its consumer to determine the meaning (if any) of a group. | |
|
reveman
2015/12/04 02:30:53
Can we make it clear here that group and priority
ericrk
2015/12/04 19:14:30
Done.
| |
| 52 struct CC_EXPORT TaskGraph { | 53 struct CC_EXPORT TaskGraph { |
| 53 struct Node { | 54 struct Node { |
| 54 typedef std::vector<Node> Vector; | 55 typedef std::vector<Node> Vector; |
|
reveman
2015/12/04 02:30:53
Btw, I'd like to remove all these Vector typedefs
ericrk
2015/12/04 19:14:30
will clean these up in a follow-up
| |
| 55 | 56 |
| 56 Node(Task* task, size_t priority, size_t dependencies) | 57 Node(Task* task, uint16_t group, uint16_t priority, size_t dependencies) |
| 57 : task(task), priority(priority), dependencies(dependencies) {} | 58 : task(task), |
| 59 group(group), | |
| 60 priority(priority), | |
| 61 dependencies(dependencies) {} | |
| 58 | 62 |
| 59 Task* task; | 63 Task* task; |
| 60 size_t priority; | 64 uint16_t group; |
| 65 uint16_t priority; | |
| 61 size_t dependencies; | 66 size_t dependencies; |
|
reveman
2015/12/04 02:30:53
How about we also change |dependencies| to uint32_
ericrk
2015/12/04 19:14:30
yup - that's definitely better.
| |
| 62 }; | 67 }; |
| 63 | 68 |
| 64 struct Edge { | 69 struct Edge { |
| 65 typedef std::vector<Edge> Vector; | 70 typedef std::vector<Edge> Vector; |
| 66 | 71 |
| 67 Edge(const Task* task, Task* dependent) | 72 Edge(const Task* task, Task* dependent) |
| 68 : task(task), dependent(dependent) {} | 73 : task(task), dependent(dependent) {} |
| 69 | 74 |
| 70 const Task* task; | 75 const Task* task; |
| 71 Task* dependent; | 76 Task* dependent; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 private: | 208 private: |
| 204 TaskGraph* graph_; | 209 TaskGraph* graph_; |
| 205 const Task* task_; | 210 const Task* task_; |
| 206 size_t current_index_; | 211 size_t current_index_; |
| 207 TaskGraph::Node* current_node_; | 212 TaskGraph::Node* current_node_; |
| 208 }; | 213 }; |
| 209 | 214 |
| 210 } // namespace cc | 215 } // namespace cc |
| 211 | 216 |
| 212 #endif // CC_RASTER_TASK_GRAPH_RUNNER_H_ | 217 #endif // CC_RASTER_TASK_GRAPH_RUNNER_H_ |
| OLD | NEW |