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

Unified Diff: cc/raster/dependency_task.cc

Issue 1854723002: cc: Simplify task and its derived classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/dependency_task.cc
diff --git a/cc/raster/dependency_task.cc b/cc/raster/dependency_task.cc
new file mode 100644
index 0000000000000000000000000000000000000000..171f3b3aba48f15c60d7b0f0538c58fe78a92e4a
--- /dev/null
+++ b/cc/raster/dependency_task.cc
@@ -0,0 +1,73 @@
+// 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/dependency_task.h"
+
+namespace cc {
+
+DependencyTask::DependencyTask()
+ : will_run_(false),
+ did_run_(false),
+ did_schedule_(false),
+ did_complete_(false) {}
+
+DependencyTask::DependencyTask(DependencyTask::Vector* dependencies)
+ : will_run_(false),
+ did_run_(false),
+ did_schedule_(false),
+ did_complete_(false) {
+ dependencies_.swap(*dependencies);
ericrk 2016/04/01 21:34:30 Rather than having them pass in a non-const * and
prashant.n 2016/04/01 23:48:05 Okay, I'll check apply this modification.
+}
+
+DependencyTask::~DependencyTask() {
+ DCHECK(!will_run_);
+ DCHECK(!did_schedule_);
+ DCHECK(!did_run_ || did_complete_);
+}
+
+void DependencyTask::WillRun() {
+ DCHECK(!will_run_);
+ DCHECK(!did_run_);
+ will_run_ = true;
+}
+
+void DependencyTask::DidRun() {
+ DCHECK(will_run_);
+ will_run_ = false;
+ did_run_ = true;
+}
+
+bool DependencyTask::HasFinishedRunning() const {
+ return did_run_;
+}
+
+void DependencyTask::WillSchedule() {
+ DCHECK(!did_schedule_);
+}
+
+void DependencyTask::DidSchedule() {
+ did_schedule_ = true;
+ did_complete_ = false;
+}
+
+bool DependencyTask::HasBeenScheduled() const {
+ return did_schedule_;
+}
+
+void DependencyTask::WillComplete() {
+ DCHECK(!did_complete_);
+}
+
+void DependencyTask::DidComplete() {
+ DCHECK(did_schedule_);
+ DCHECK(!did_complete_);
+ did_schedule_ = false;
+ did_complete_ = true;
+}
+
+bool DependencyTask::HasCompleted() const {
+ return did_complete_;
+}
+
+} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698