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

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

Issue 1854723002: cc: Simplify task and its derived classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary static cast. 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 #include "cc/raster/task.h"
6
7 #include "base/logging.h"
8
9 namespace cc {
10
11 Task::Task()
12 : did_schedule_(false),
13 did_complete_(false),
14 will_run_(false),
15 did_run_(false) {}
16
17 Task::Task(Task::Vector* dependencies)
18 : did_schedule_(false),
19 did_complete_(false),
20 will_run_(false),
21 did_run_(false) {
22 dependencies_ = std::move(*dependencies);
23 }
24
25 Task::~Task() {
26 DCHECK(!did_schedule_);
27 DCHECK(!will_run_);
28 DCHECK(!did_run_ || did_complete_);
29 }
30
31 void Task::WillRun() {
32 DCHECK(!will_run_);
33 DCHECK(!did_run_);
34 will_run_ = true;
35 }
36
37 void Task::DidRun() {
38 DCHECK(will_run_);
39 will_run_ = false;
40 did_run_ = true;
41 }
42
43 bool Task::HasFinishedRunning() const {
44 return did_run_;
45 }
46
47 void Task::WillSchedule() {
48 DCHECK(!did_schedule_);
49 }
50
51 void Task::DidSchedule() {
52 did_schedule_ = true;
53 did_complete_ = false;
54 }
55
56 bool Task::HasBeenScheduled() const {
57 return did_schedule_;
58 }
59
60 void Task::WillComplete() {
61 DCHECK(!did_complete_);
62 }
63
64 void Task::DidComplete() {
65 DCHECK(did_schedule_);
66 DCHECK(!did_complete_);
67 did_schedule_ = false;
68 did_complete_ = true;
69 }
70
71 bool Task::HasCompleted() const {
72 return did_complete_;
73 }
74
75 } // namespace cc
OLDNEW
« cc/raster/task.h ('K') | « cc/raster/task.h ('k') | cc/raster/task_graph_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698