Chromium Code Reviews| Index: cc/raster/dependency_task.h |
| diff --git a/cc/raster/dependency_task.h b/cc/raster/dependency_task.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7ee706a5ec6e29659b8c220fc35b2efbb496fb82 |
| --- /dev/null |
| +++ b/cc/raster/dependency_task.h |
| @@ -0,0 +1,65 @@ |
| +// 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
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_RASTER_DEPENDENCY_TASK_H_ |
| +#define CC_RASTER_DEPENDENCY_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 DependencyTask, it should be inserted into a TaskGraph, which can then |
| +// be scheduled on the TaskGraphRunner. |
| +class CC_EXPORT DependencyTask |
| + : public base::RefCountedThreadSafe<DependencyTask> { |
| + public: |
| + typedef std::vector<scoped_refptr<DependencyTask>> Vector; |
| + |
| + const DependencyTask::Vector& dependencies() const { return dependencies_; } |
| + |
| + // 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<DependencyTask>; |
| + |
| + // For creating task without dependencies. |
| + DependencyTask(); |
| + // For creating task with dependencies. |
| + explicit DependencyTask(DependencyTask::Vector* dependencies); |
| + virtual ~DependencyTask(); |
| + |
| + bool did_schedule_; |
| + bool did_complete_; |
| + bool will_run_; |
| + bool did_run_; |
| + |
| + DependencyTask::Vector dependencies_; |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_RASTER_DEPENDENCY_TASK_H_ |