OLD | NEW |
(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 : type_(TASK_TYPE_DEFAULT), |
| 13 will_run_(false), |
| 14 did_run_(false), |
| 15 did_complete_(false) {} |
| 16 |
| 17 Task::Task(Task::Vector* dependencies) |
| 18 : dependencies_(std::move(*dependencies)), |
| 19 type_(TASK_TYPE_DEFAULT), |
| 20 will_run_(false), |
| 21 did_run_(false), |
| 22 did_complete_(false) {} |
| 23 |
| 24 Task::~Task() { |
| 25 DCHECK(!will_run_); |
| 26 DCHECK(!did_run_ || did_complete_); |
| 27 } |
| 28 |
| 29 void Task::WillRun() { |
| 30 DCHECK(!will_run_); |
| 31 DCHECK(!did_run_); |
| 32 will_run_ = true; |
| 33 } |
| 34 |
| 35 void Task::DidRun() { |
| 36 DCHECK(will_run_); |
| 37 will_run_ = false; |
| 38 did_run_ = true; |
| 39 } |
| 40 |
| 41 bool Task::HasFinishedRunning() const { |
| 42 return did_run_; |
| 43 } |
| 44 |
| 45 void Task::DidComplete() { |
| 46 DCHECK(!did_complete_); |
| 47 did_complete_ = true; |
| 48 } |
| 49 |
| 50 bool Task::HasCompleted() const { |
| 51 return did_complete_; |
| 52 } |
| 53 |
| 54 bool Task::SupportsConcurrentExecution() const { |
| 55 return true; |
| 56 } |
| 57 |
| 58 TaskType Task::GetTaskType() { |
| 59 return type_; |
| 60 } |
| 61 |
| 62 void Task::SetTaskType(TaskType type) { |
| 63 type_ = type; |
| 64 } |
| 65 |
| 66 } // namespace cc |
OLD | NEW |