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_RESOURCES_TASK_GRAPH_RUNNER_H_ | 5 #ifndef CC_RESOURCES_TASK_GRAPH_RUNNER_H_ |
6 #define CC_RESOURCES_TASK_GRAPH_RUNNER_H_ | 6 #define CC_RESOURCES_TASK_GRAPH_RUNNER_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/containers/scoped_ptr_hash_map.h" | |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/synchronization/condition_variable.h" | 13 #include "base/synchronization/condition_variable.h" |
14 #include "base/threading/simple_thread.h" | 14 #include "base/threading/simple_thread.h" |
15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
16 #include "cc/base/scoped_ptr_deque.h" | 16 #include "cc/base/scoped_ptr_deque.h" |
17 | 17 |
18 namespace cc { | 18 namespace cc { |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 class CC_EXPORT Task : public base::RefCountedThreadSafe<Task> { | 21 class CC_EXPORT Task : public base::RefCountedThreadSafe<Task> { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Ordered set of tasks that are ready to run. | 153 // Ordered set of tasks that are ready to run. |
154 PrioritizedTask::Vector ready_to_run_tasks; | 154 PrioritizedTask::Vector ready_to_run_tasks; |
155 | 155 |
156 // Completed tasks not yet collected by origin thread. | 156 // Completed tasks not yet collected by origin thread. |
157 Task::Vector completed_tasks; | 157 Task::Vector completed_tasks; |
158 | 158 |
159 // Number of currently running tasks. | 159 // Number of currently running tasks. |
160 size_t num_running_tasks; | 160 size_t num_running_tasks; |
161 }; | 161 }; |
162 | 162 |
163 typedef base::ScopedPtrHashMap<int, TaskNamespace> TaskNamespaceMap; | 163 typedef std::map<int, TaskNamespace> TaskNamespaceMap; |
164 | 164 |
165 static bool CompareTaskPriority(const PrioritizedTask& a, | 165 static bool CompareTaskPriority(const PrioritizedTask& a, |
166 const PrioritizedTask& b) { | 166 const PrioritizedTask& b) { |
167 // In this system, numerically lower priority is run first. | 167 // In this system, numerically lower priority is run first. |
168 return a.priority > b.priority; | 168 return a.priority > b.priority; |
169 } | 169 } |
170 | 170 |
171 static bool CompareTaskNamespacePriority(const TaskNamespace* a, | 171 static bool CompareTaskNamespacePriority(const TaskNamespace* a, |
172 const TaskNamespace* b) { | 172 const TaskNamespace* b) { |
173 DCHECK(!a->ready_to_run_tasks.empty()); | 173 DCHECK(!a->ready_to_run_tasks.empty()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 230 |
231 ScopedPtrDeque<base::DelegateSimpleThread> workers_; | 231 ScopedPtrDeque<base::DelegateSimpleThread> workers_; |
232 | 232 |
233 DISALLOW_COPY_AND_ASSIGN(TaskGraphRunner); | 233 DISALLOW_COPY_AND_ASSIGN(TaskGraphRunner); |
234 }; | 234 }; |
235 | 235 |
236 } // namespace internal | 236 } // namespace internal |
237 } // namespace cc | 237 } // namespace cc |
238 | 238 |
239 #endif // CC_RESOURCES_TASK_GRAPH_RUNNER_H_ | 239 #endif // CC_RESOURCES_TASK_GRAPH_RUNNER_H_ |
OLD | NEW |