Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2749)

Unified Diff: cc/raster/task_graph_runner.h

Issue 1854723002: cc: Simplify task and its derived classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/raster/task_graph_runner.h
diff --git a/cc/raster/task_graph_runner.h b/cc/raster/task_graph_runner.h
index 23094ef5a7ef3c81a6cae0fbde931c57c11efe98..c81e7241bb571c39a31d24495b93fc49f7863478 100644
--- a/cc/raster/task_graph_runner.h
+++ b/cc/raster/task_graph_runner.h
@@ -16,37 +16,12 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
+#include "cc/raster/dependency_task.h"
namespace cc {
class TaskGraphRunner;
-// 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;
-
- // 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;
-
- protected:
- friend class base::RefCountedThreadSafe<Task>;
-
- Task();
- virtual ~Task();
-
- bool will_run_;
- bool did_run_;
-};
-
// A task dependency graph describes the order in which to execute a set
// of tasks. Dependencies are represented as edges. Each node is assigned
// a category, a priority and a run count that matches the number of
@@ -59,7 +34,7 @@ struct CC_EXPORT TaskGraph {
struct Node {
typedef std::vector<Node> Vector;
- Node(Task* task,
+ Node(DependencyTask* task,
uint16_t category,
uint16_t priority,
uint32_t dependencies)
@@ -68,7 +43,7 @@ struct CC_EXPORT TaskGraph {
priority(priority),
dependencies(dependencies) {}
- Task* task;
+ DependencyTask* task;
uint16_t category;
uint16_t priority;
uint32_t dependencies;
@@ -77,11 +52,11 @@ struct CC_EXPORT TaskGraph {
struct Edge {
typedef std::vector<Edge> Vector;
- Edge(const Task* task, Task* dependent)
+ Edge(const DependencyTask* task, DependencyTask* dependent)
: task(task), dependent(dependent) {}
- const Task* task;
- Task* dependent;
+ const DependencyTask* task;
+ DependencyTask* dependent;
};
TaskGraph();
@@ -159,8 +134,9 @@ class CC_EXPORT TaskGraphRunner {
virtual void WaitForTasksToFinishRunning(NamespaceToken token) = 0;
// Collect all completed tasks in |completed_tasks|.
- virtual void CollectCompletedTasks(NamespaceToken token,
- Task::Vector* completed_tasks) = 0;
+ virtual void CollectCompletedTasks(
+ NamespaceToken token,
+ DependencyTask::Vector* completed_tasks) = 0;
protected:
virtual ~TaskGraphRunner() {}
@@ -169,7 +145,7 @@ class CC_EXPORT TaskGraphRunner {
// Helper class for iterating over all dependents of a task.
class DependentIterator {
public:
- DependentIterator(TaskGraph* graph, const Task* task)
+ DependentIterator(TaskGraph* graph, const DependencyTask* task)
: graph_(graph),
task_(task),
current_index_(static_cast<size_t>(-1)),
@@ -216,7 +192,7 @@ class DependentIterator {
private:
TaskGraph* graph_;
- const Task* task_;
+ const DependencyTask* task_;
size_t current_index_;
TaskGraph::Node* current_node_;
};

Powered by Google App Engine
This is Rietveld 408576698