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

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

Issue 1854723002: cc: Simplify task and its derived classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected scope of dependencies. 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
OLDNEW
(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 <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 Task, it should be inserted into a TaskGraph, which can then
18 // be scheduled on the TaskGraphRunner.
19 class CC_EXPORT Task : public base::RefCountedThreadSafe<Task> {
20 public:
21 typedef std::vector<scoped_refptr<Task>> Vector;
22
23 // Subclasses should implement these methods. ScheduleOnOriginThread() and
24 // CompleteOnOriginThread() must be called on origin thread and
25 // RunOnWorkerThread() may be called on any thread (origin or worker). The
26 // subclasses are responsible for locking and thread safety.
27 virtual void ScheduleOnOriginThread() = 0;
28 virtual void CompleteOnOriginThread() = 0;
29 virtual void RunOnWorkerThread() = 0;
30
31 void WillSchedule();
32 void DidSchedule();
33 bool HasBeenScheduled() const;
34
35 void WillComplete();
36 void DidComplete();
37 bool HasCompleted() const;
38
39 void WillRun();
40 void DidRun();
41 bool HasFinishedRunning() const;
42
43 protected:
44 friend class base::RefCountedThreadSafe<Task>;
45
46 Task();
47 virtual ~Task();
48
49 bool did_schedule_;
50 bool did_complete_;
51 bool will_run_;
52 bool did_run_;
53 };
54
55 } // namespace cc
56
57 #endif // CC_RASTER_TASK_H_
OLDNEW
« no previous file with comments | « cc/raster/raster_buffer.h ('k') | cc/raster/task.cc » ('j') | cc/tiles/tile_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698