OLD | NEW |
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_WORKER_POOL_H_ | 5 #ifndef CC_RESOURCES_WORKER_POOL_H_ |
6 #define CC_RESOURCES_WORKER_POOL_H_ | 6 #define CC_RESOURCES_WORKER_POOL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 virtual void Shutdown(); | 73 virtual void Shutdown(); |
74 | 74 |
75 // Force a check for completed tasks. | 75 // Force a check for completed tasks. |
76 virtual void CheckForCompletedTasks(); | 76 virtual void CheckForCompletedTasks(); |
77 | 77 |
78 protected: | 78 protected: |
79 class CC_EXPORT GraphNode { | 79 class CC_EXPORT GraphNode { |
80 public: | 80 public: |
81 typedef std::vector<GraphNode*> Vector; | 81 typedef std::vector<GraphNode*> Vector; |
82 | 82 |
83 GraphNode(); | 83 GraphNode(internal::WorkerPoolTask* task, unsigned priority); |
84 ~GraphNode(); | 84 ~GraphNode(); |
85 | 85 |
86 void set_task(internal::WorkerPoolTask* task) { task_ = task; } | |
87 internal::WorkerPoolTask* task() { return task_; } | 86 internal::WorkerPoolTask* task() { return task_; } |
88 | 87 |
89 void add_dependent(GraphNode* dependent) { | 88 void add_dependent(GraphNode* dependent) { |
90 DCHECK(dependent); | 89 DCHECK(dependent); |
91 dependents_.push_back(dependent); | 90 dependents_.push_back(dependent); |
92 } | 91 } |
93 const Vector& dependents() const { | 92 const Vector& dependents() const { |
94 return dependents_; | 93 return dependents_; |
95 } | 94 } |
96 | 95 |
97 void set_priority(unsigned priority) { priority_ = priority; } | |
98 unsigned priority() const { return priority_; } | 96 unsigned priority() const { return priority_; } |
99 | 97 |
100 unsigned num_dependencies() const { | 98 unsigned num_dependencies() const { |
101 return num_dependencies_; | 99 return num_dependencies_; |
102 } | 100 } |
103 void add_dependency() { ++num_dependencies_; } | 101 void add_dependency() { ++num_dependencies_; } |
104 void remove_dependency() { | 102 void remove_dependency() { |
105 DCHECK(num_dependencies_); | 103 DCHECK(num_dependencies_); |
106 --num_dependencies_; | 104 --num_dependencies_; |
107 } | 105 } |
(...skipping 30 matching lines...) Expand all Loading... |
138 | 136 |
139 bool in_dispatch_completion_callbacks_; | 137 bool in_dispatch_completion_callbacks_; |
140 | 138 |
141 // Hide the gory details of the worker pool in |inner_|. | 139 // Hide the gory details of the worker pool in |inner_|. |
142 const scoped_ptr<Inner> inner_; | 140 const scoped_ptr<Inner> inner_; |
143 }; | 141 }; |
144 | 142 |
145 } // namespace cc | 143 } // namespace cc |
146 | 144 |
147 #endif // CC_RESOURCES_WORKER_POOL_H_ | 145 #endif // CC_RESOURCES_WORKER_POOL_H_ |
OLD | NEW |