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

Side by Side Diff: cc/raster/dependency_task.h

Issue 1854723002: cc: Simplify task and its derived classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « cc/raster/bitmap_tile_task_worker_pool.cc ('k') | cc/raster/dependency_task.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // 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
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_DEPENDENCY_TASK_H_
6 #define CC_RASTER_DEPENDENCY_TASK_H_
7
8 #include <vector>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "cc/base/cc_export.h"
13
14 namespace cc {
15
16 // A task with or without dependencies which can be run by a TaskGraphRunner. To
17 // run a DependencyTask, it should be inserted into a TaskGraph, which can then
18 // be scheduled on the TaskGraphRunner.
19 class CC_EXPORT DependencyTask
20 : public base::RefCountedThreadSafe<DependencyTask> {
21 public:
22 typedef std::vector<scoped_refptr<DependencyTask>> Vector;
23
24 const DependencyTask::Vector& dependencies() const { return dependencies_; }
25
26 // Subclasses should implement these methods. ScheduleOnOriginThread() and
27 // CompleteOnOriginThread() must be called on origin thread and
28 // RunOnWorkerThread() may be called on any thread (origin or worker). The
29 // subclasses are responsible for locking and thread safety.
30 virtual void ScheduleOnOriginThread() = 0;
31 virtual void CompleteOnOriginThread() = 0;
32 virtual void RunOnWorkerThread() = 0;
33
34 void WillSchedule();
35 void DidSchedule();
36 bool HasBeenScheduled() const;
37
38 void WillComplete();
39 void DidComplete();
40 bool HasCompleted() const;
41
42 void WillRun();
43 void DidRun();
44 bool HasFinishedRunning() const;
45
46 protected:
47 friend class base::RefCountedThreadSafe<DependencyTask>;
48
49 // For creating task without dependencies.
50 DependencyTask();
51 // For creating task with dependencies.
52 explicit DependencyTask(DependencyTask::Vector* dependencies);
53 virtual ~DependencyTask();
54
55 bool did_schedule_;
56 bool did_complete_;
57 bool will_run_;
58 bool did_run_;
59
60 DependencyTask::Vector dependencies_;
61 };
62
63 } // namespace cc
64
65 #endif // CC_RASTER_DEPENDENCY_TASK_H_
OLDNEW
« no previous file with comments | « cc/raster/bitmap_tile_task_worker_pool.cc ('k') | cc/raster/dependency_task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698