Chromium Code Reviews| 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 <stdint.h> | |
| 9 | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "cc/base/cc_export.h" | |
| 14 #include "cc/raster/task_types.h" | |
| 15 | |
| 16 namespace cc { | |
| 17 | |
| 18 // A task which can be run by a TaskGraphRunner. To run a Task, it should be | |
| 19 // inserted into a TaskGraph, which can then be scheduled on the | |
| 20 // TaskGraphRunner. | |
| 21 class CC_EXPORT Task : public base::RefCountedThreadSafe<Task> { | |
| 22 public: | |
| 23 typedef std::vector<scoped_refptr<Task>> Vector; | |
| 24 | |
| 25 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
| |
| 26 | |
| 27 // Indicates whether this task can be run at the same time as other tasks in | |
| 28 // the task graph. If false, this task will be scheduled with | |
| 29 // TASK_CATEGORY_NONCONCURRENT_FOREGROUND. The base implementation always | |
| 30 // returns true. | |
| 31 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
| |
| 32 | |
| 33 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
| |
| 34 | |
| 35 // Subclasses should implement this method. RunOnWorkerThread may be called | |
| 36 // on any thread, and subclasses are responsible for locking and thread | |
| 37 // safety. | |
| 38 virtual void RunOnWorkerThread() = 0; | |
| 39 | |
| 40 void WillRun(); | |
| 41 void DidRun(); | |
| 42 bool HasFinishedRunning() const; | |
|
prashant.n
2016/04/17 17:37:48
Basically Task should expose only HasFinishedRunni
| |
| 43 | |
| 44 void DidComplete(); | |
| 45 bool HasCompleted() const; | |
| 46 | |
| 47 protected: | |
| 48 friend class base::RefCountedThreadSafe<Task>; | |
| 49 | |
| 50 void SetTaskType(TaskType type); | |
| 51 | |
| 52 Task(); | |
| 53 explicit Task(Task::Vector* dependencies); | |
| 54 virtual ~Task(); | |
| 55 | |
| 56 Task::Vector dependencies_; | |
| 57 TaskType type_; | |
|
reveman
2016/04/16 10:10:28
private to tilemanager's implementation would mean
| |
| 58 bool will_run_; | |
| 59 bool did_run_; | |
| 60 bool did_complete_; | |
| 61 }; | |
| 62 | |
| 63 } // namespace cc | |
| 64 | |
| 65 #endif // CC_RASTER_TASK_H_ | |
| OLD | NEW |