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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 typedef GraphNodeMap TaskGraph; | 118 typedef GraphNodeMap TaskGraph; |
119 | 119 |
120 WorkerPool(size_t num_threads, const std::string& thread_name_prefix); | 120 WorkerPool(size_t num_threads, const std::string& thread_name_prefix); |
121 | 121 |
122 // Schedule running of tasks in |graph|. Any previously scheduled tasks | 122 // Schedule running of tasks in |graph|. Any previously scheduled tasks |
123 // that are not already running will be canceled. Canceled tasks don't run | 123 // that are not already running will be canceled. Canceled tasks don't run |
124 // but completion of them is still processed. | 124 // but completion of them is still processed. |
125 void SetTaskGraph(TaskGraph* graph); | 125 void SetTaskGraph(TaskGraph* graph); |
126 | 126 |
127 private: | 127 private: |
128 class Inner; | 128 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; |
129 friend class Inner; | |
130 | 129 |
131 typedef std::vector<scoped_refptr<internal::WorkerPoolTask> > TaskVector; | 130 // Pulled the task graphs out of Inner |
| 131 // This set contains all pending tasks. |
| 132 // GraphNodeMap pending_tasks_; |
| 133 |
| 134 // Completed tasks not yet collected by origin thread. |
| 135 // TaskVector completed_tasks_; |
| 136 |
| 137 // This set contains all currently running tasks. |
| 138 // GraphNodeMap running_tasks_; |
132 | 139 |
133 void ProcessCompletedTasks(const TaskVector& completed_tasks); | 140 void ProcessCompletedTasks(const TaskVector& completed_tasks); |
134 | 141 |
135 bool in_dispatch_completion_callbacks_; | 142 bool in_dispatch_completion_callbacks_; |
136 | |
137 // Hide the gory details of the worker pool in |inner_|. | |
138 const scoped_ptr<Inner> inner_; | |
139 }; | 143 }; |
140 | 144 |
141 } // namespace cc | 145 } // namespace cc |
142 | 146 |
143 #endif // CC_RESOURCES_WORKER_POOL_H_ | 147 #endif // CC_RESOURCES_WORKER_POOL_H_ |
OLD | NEW |