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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: cc/raster/task.cc
diff --git a/cc/raster/task.cc b/cc/raster/task.cc
new file mode 100644
index 0000000000000000000000000000000000000000..eea53c26e9f22996003d3caacffb34cc5b50d3b5
--- /dev/null
+++ b/cc/raster/task.cc
@@ -0,0 +1,75 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/raster/task.h"
+
+#include "base/logging.h"
+
+namespace cc {
+
+Task::Task()
+ : did_schedule_(false),
+ did_complete_(false),
+ will_run_(false),
+ did_run_(false) {}
+
+Task::Task(Task::Vector* dependencies)
+ : did_schedule_(false),
+ did_complete_(false),
+ will_run_(false),
+ did_run_(false) {
+ dependencies_ = std::move(*dependencies);
+}
+
+Task::~Task() {
+ DCHECK(!did_schedule_);
+ DCHECK(!will_run_);
+ DCHECK(!did_run_ || did_complete_);
+}
+
+void Task::WillRun() {
+ DCHECK(!will_run_);
+ DCHECK(!did_run_);
+ will_run_ = true;
+}
+
+void Task::DidRun() {
+ DCHECK(will_run_);
+ will_run_ = false;
+ did_run_ = true;
+}
+
+bool Task::HasFinishedRunning() const {
+ return did_run_;
+}
+
+void Task::WillSchedule() {
+ DCHECK(!did_schedule_);
+}
+
+void Task::DidSchedule() {
+ did_schedule_ = true;
+ did_complete_ = false;
+}
+
+bool Task::HasBeenScheduled() const {
+ return did_schedule_;
+}
+
+void Task::WillComplete() {
+ DCHECK(!did_complete_);
+}
+
+void Task::DidComplete() {
+ DCHECK(did_schedule_);
+ DCHECK(!did_complete_);
+ did_schedule_ = false;
+ did_complete_ = true;
+}
+
+bool Task::HasCompleted() const {
+ return did_complete_;
+}
+
+} // namespace cc
« 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