OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
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_TASK_H_ | |
6 #define CC_RASTER_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 Task, it should be inserted into a TaskGraph, which can then | |
18 // be scheduled on the TaskGraphRunner. | |
19 class CC_EXPORT Task : public base::RefCountedThreadSafe<Task> { | |
reveman
2016/04/06 12:18:06
dependencies should not be part of the task. it sh
prashant.n
2016/04/06 13:11:50
Yes. I just checked, we are already keeping that i
| |
20 public: | |
21 typedef std::vector<scoped_refptr<Task>> Vector; | |
22 | |
23 const Task::Vector& dependencies() const { return dependencies_; } | |
24 | |
25 // Subclasses should implement these methods. ScheduleOnOriginThread() and | |
26 // CompleteOnOriginThread() must be called on origin thread and | |
27 // RunOnWorkerThread() may be called on any thread (origin or worker). The | |
28 // subclasses are responsible for locking and thread safety. | |
29 virtual void ScheduleOnOriginThread() = 0; | |
30 virtual void CompleteOnOriginThread() = 0; | |
reveman
2016/04/06 12:18:06
Schedule/Complete should not be part of the task c
prashant.n
2016/04/06 13:11:50
Do you mean to say, having this only in dervied cl
| |
31 virtual void RunOnWorkerThread() = 0; | |
32 | |
33 void WillSchedule(); | |
34 void DidSchedule(); | |
35 bool HasBeenScheduled() const; | |
36 | |
37 void WillComplete(); | |
38 void DidComplete(); | |
39 bool HasCompleted() const; | |
40 | |
41 void WillRun(); | |
42 void DidRun(); | |
43 bool HasFinishedRunning() const; | |
44 | |
45 protected: | |
46 friend class base::RefCountedThreadSafe<Task>; | |
47 | |
48 // For creating task without dependencies. | |
49 Task(); | |
50 // For creating task with dependencies. | |
51 explicit Task(Task::Vector* dependencies); | |
52 virtual ~Task(); | |
53 | |
54 bool did_schedule_; | |
55 bool did_complete_; | |
56 bool will_run_; | |
57 bool did_run_; | |
58 | |
59 Task::Vector dependencies_; | |
60 }; | |
61 | |
62 } // namespace cc | |
63 | |
64 #endif // CC_RASTER_TASK_H_ | |
OLD | NEW |