OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
reveman
2016/04/05 19:14:05
can you avoid this change as part of this patch an
prashant.n
2016/04/06 00:28:11
Ok. Should that be subsequent change or should rev
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_RASTER_DEPENDENCY_TASK_H_ | |
6 #define CC_RASTER_DEPENDENCY_TASK_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "cc/base/cc_export.h" | |
13 | |
14 namespace cc { | |
15 | |
16 // A task with or without dependencies which can be run by a TaskGraphRunner. To | |
17 // run a DependencyTask, it should be inserted into a TaskGraph, which can then | |
18 // be scheduled on the TaskGraphRunner. | |
19 class CC_EXPORT DependencyTask | |
20 : public base::RefCountedThreadSafe<DependencyTask> { | |
21 public: | |
22 typedef std::vector<scoped_refptr<DependencyTask>> Vector; | |
23 | |
24 const DependencyTask::Vector& dependencies() const { return dependencies_; } | |
25 | |
26 // Subclasses should implement these methods. ScheduleOnOriginThread() and | |
27 // CompleteOnOriginThread() must be called on origin thread and | |
28 // RunOnWorkerThread() may be called on any thread (origin or worker). The | |
29 // subclasses are responsible for locking and thread safety. | |
30 virtual void ScheduleOnOriginThread() = 0; | |
31 virtual void CompleteOnOriginThread() = 0; | |
32 virtual void RunOnWorkerThread() = 0; | |
33 | |
34 void WillSchedule(); | |
35 void DidSchedule(); | |
36 bool HasBeenScheduled() const; | |
37 | |
38 void WillComplete(); | |
39 void DidComplete(); | |
40 bool HasCompleted() const; | |
41 | |
42 void WillRun(); | |
43 void DidRun(); | |
44 bool HasFinishedRunning() const; | |
45 | |
46 protected: | |
47 friend class base::RefCountedThreadSafe<DependencyTask>; | |
48 | |
49 // For creating task without dependencies. | |
50 DependencyTask(); | |
51 // For creating task with dependencies. | |
52 explicit DependencyTask(DependencyTask::Vector* dependencies); | |
53 virtual ~DependencyTask(); | |
54 | |
55 bool did_schedule_; | |
56 bool did_complete_; | |
57 bool will_run_; | |
58 bool did_run_; | |
59 | |
60 DependencyTask::Vector dependencies_; | |
61 }; | |
62 | |
63 } // namespace cc | |
64 | |
65 #endif // CC_RASTER_DEPENDENCY_TASK_H_ | |
OLD | NEW |