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 <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/containers/scoped_ptr_hash_map.h" | 12 #include "base/containers/scoped_ptr_hash_map.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/synchronization/condition_variable.h" | 15 #include "base/synchronization/condition_variable.h" |
16 #include "base/threading/simple_thread.h" | 16 #include "base/threading/simple_thread.h" |
17 #include "cc/base/cc_export.h" | 17 #include "cc/base/cc_export.h" |
18 #include "cc/base/scoped_ptr_deque.h" | 18 #include "cc/base/scoped_ptr_deque.h" |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 namespace internal { | 21 namespace internal { |
22 | 22 |
23 class CC_EXPORT Task : public base::RefCountedThreadSafe<Task> { | 23 class CC_EXPORT Task : public base::RefCountedThreadSafe<Task> { |
24 public: | 24 public: |
25 typedef std::vector<scoped_refptr<Task> > Vector; | 25 typedef std::vector<scoped_refptr<Task> > Vector; |
26 | 26 |
27 virtual void RunOnWorkerThread(unsigned thread_index) = 0; | 27 virtual void RunOnWorkerThread(unsigned thread_index) = 0; |
28 | 28 |
29 void DidSchedule(); | |
30 void WillRun(); | 29 void WillRun(); |
31 void DidRun(); | 30 void DidRun(); |
32 | |
33 bool HasFinishedRunning() const; | 31 bool HasFinishedRunning() const; |
34 | 32 |
35 protected: | 33 protected: |
36 friend class base::RefCountedThreadSafe<Task>; | 34 friend class base::RefCountedThreadSafe<Task>; |
37 | 35 |
38 Task(); | 36 Task(); |
39 virtual ~Task(); | 37 virtual ~Task(); |
40 | 38 |
41 bool did_schedule_; | |
42 bool did_run_; | 39 bool did_run_; |
43 }; | 40 }; |
44 | 41 |
45 } // namespace internal | 42 } // namespace internal |
46 } // namespace cc | 43 } // namespace cc |
47 | 44 |
48 #if defined(COMPILER_GCC) | 45 #if defined(COMPILER_GCC) |
49 namespace BASE_HASH_NAMESPACE { | 46 namespace BASE_HASH_NAMESPACE { |
50 template <> | 47 template <> |
51 struct hash<cc::internal::Task*> { | 48 struct hash<cc::internal::Task*> { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 230 |
234 ScopedPtrDeque<base::DelegateSimpleThread> workers_; | 231 ScopedPtrDeque<base::DelegateSimpleThread> workers_; |
235 | 232 |
236 DISALLOW_COPY_AND_ASSIGN(TaskGraphRunner); | 233 DISALLOW_COPY_AND_ASSIGN(TaskGraphRunner); |
237 }; | 234 }; |
238 | 235 |
239 } // namespace internal | 236 } // namespace internal |
240 } // namespace cc | 237 } // namespace cc |
241 | 238 |
242 #endif // CC_RESOURCES_TASK_GRAPH_RUNNER_H_ | 239 #endif // CC_RESOURCES_TASK_GRAPH_RUNNER_H_ |
OLD | NEW |