Index: cc/raster/task.h |
diff --git a/cc/raster/task.h b/cc/raster/task.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f6f91a2982702186122f6780ca580227ba7462a9 |
--- /dev/null |
+++ b/cc/raster/task.h |
@@ -0,0 +1,65 @@ |
+// 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 <stdint.h> |
+ |
+#include <vector> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "cc/base/cc_export.h" |
+#include "cc/raster/task_types.h" |
+ |
+namespace cc { |
+ |
+// A task 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; |
+ |
+ TaskType GetTaskType(); |
reveman
2016/04/16 10:10:28
can this be private to tilemanager's task implemen
prashant.n
2016/04/17 17:37:48
Hmm. As TileManager only schedules the type of tas
|
+ |
+ // Indicates whether this task can be run at the same time as other tasks in |
+ // the task graph. If false, this task will be scheduled with |
+ // TASK_CATEGORY_NONCONCURRENT_FOREGROUND. The base implementation always |
+ // returns true. |
+ virtual bool SupportsConcurrentExecution() const; |
reveman
2016/04/16 10:10:28
this should preferably be private to tilemanager's
prashant.n
2016/04/17 17:37:48
Making this generic would save having one more hie
|
+ |
+ const Task::Vector& dependencies() const { return dependencies_; } |
reveman
2016/04/16 10:10:28
and this
prashant.n
2016/04/17 17:37:48
Having dependencies kept in Task, would help TileM
reveman
2016/04/17 20:08:23
Task class should not contain anything but what's
|
+ |
+ // Subclasses should implement this method. RunOnWorkerThread may be called |
+ // on any thread, and subclasses are responsible for locking and thread |
+ // safety. |
+ virtual void RunOnWorkerThread() = 0; |
+ |
+ void WillRun(); |
+ void DidRun(); |
+ bool HasFinishedRunning() const; |
prashant.n
2016/04/17 17:37:48
Basically Task should expose only HasFinishedRunni
|
+ |
+ void DidComplete(); |
+ bool HasCompleted() const; |
+ |
+ protected: |
+ friend class base::RefCountedThreadSafe<Task>; |
+ |
+ void SetTaskType(TaskType type); |
+ |
+ Task(); |
+ explicit Task(Task::Vector* dependencies); |
+ virtual ~Task(); |
+ |
+ Task::Vector dependencies_; |
+ TaskType type_; |
reveman
2016/04/16 10:10:28
private to tilemanager's implementation would mean
|
+ bool will_run_; |
+ bool did_run_; |
+ bool did_complete_; |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_RASTER_TASK_H_ |