Index: cc/raster/task.h |
diff --git a/cc/raster/task.h b/cc/raster/task.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7ce90977b0813b581b8d2af10502be2e3ab14819 |
--- /dev/null |
+++ b/cc/raster/task.h |
@@ -0,0 +1,57 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CC_RASTER_TASK_H_ |
+#define CC_RASTER_TASK_H_ |
+ |
+#include <vector> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "cc/base/cc_export.h" |
+ |
+namespace cc { |
+ |
+// A task with or without dependencies which can be run by a TaskGraphRunner. To |
+// run a Task, it should be inserted into a TaskGraph, which can then |
+// be scheduled on the TaskGraphRunner. |
+class CC_EXPORT Task : public base::RefCountedThreadSafe<Task> { |
+ public: |
+ typedef std::vector<scoped_refptr<Task>> Vector; |
+ |
+ // Subclasses should implement these methods. ScheduleOnOriginThread() and |
+ // CompleteOnOriginThread() must be called on origin thread and |
+ // RunOnWorkerThread() may be called on any thread (origin or worker). The |
+ // subclasses are responsible for locking and thread safety. |
+ virtual void ScheduleOnOriginThread() = 0; |
+ virtual void CompleteOnOriginThread() = 0; |
+ virtual void RunOnWorkerThread() = 0; |
+ |
+ void WillSchedule(); |
+ void DidSchedule(); |
+ bool HasBeenScheduled() const; |
+ |
+ void WillComplete(); |
+ void DidComplete(); |
+ bool HasCompleted() const; |
+ |
+ void WillRun(); |
+ void DidRun(); |
+ bool HasFinishedRunning() const; |
+ |
+ protected: |
+ friend class base::RefCountedThreadSafe<Task>; |
+ |
+ Task(); |
+ virtual ~Task(); |
+ |
+ bool did_schedule_; |
+ bool did_complete_; |
+ bool will_run_; |
+ bool did_run_; |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_RASTER_TASK_H_ |