| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/raster/task_graph_runner.h" | 5 #include "cc/raster/task_graph_runner.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| 11 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 Task::Task() : will_run_(false), did_run_(false) {} | 16 Task::Task() |
| 17 : type_id_(kDefaultTaskTypeId), will_run_(false), did_run_(false) {} |
| 17 | 18 |
| 18 Task::~Task() { | 19 Task::~Task() { |
| 19 DCHECK(!will_run_); | 20 DCHECK(!will_run_); |
| 20 } | 21 } |
| 21 | 22 |
| 22 void Task::WillRun() { | 23 void Task::WillRun() { |
| 23 DCHECK(!will_run_); | 24 DCHECK(!will_run_); |
| 24 DCHECK(!did_run_); | 25 DCHECK(!did_run_); |
| 25 will_run_ = true; | 26 will_run_ = true; |
| 26 } | 27 } |
| 27 | 28 |
| 28 void Task::DidRun() { | 29 void Task::DidRun() { |
| 29 DCHECK(will_run_); | 30 DCHECK(will_run_); |
| 30 will_run_ = false; | 31 will_run_ = false; |
| 31 did_run_ = true; | 32 did_run_ = true; |
| 32 } | 33 } |
| 33 | 34 |
| 34 bool Task::HasFinishedRunning() const { | 35 bool Task::HasFinishedRunning() const { |
| 35 return did_run_; | 36 return did_run_; |
| 36 } | 37 } |
| 37 | 38 |
| 39 TaskTypeId Task::GetTaskTypeId() { |
| 40 return type_id_; |
| 41 } |
| 42 |
| 43 void Task::SetTaskTypeId(TaskTypeId type_id) { |
| 44 type_id_ = type_id; |
| 45 } |
| 46 |
| 38 TaskGraph::TaskGraph() {} | 47 TaskGraph::TaskGraph() {} |
| 39 | 48 |
| 40 TaskGraph::TaskGraph(const TaskGraph& other) = default; | 49 TaskGraph::TaskGraph(const TaskGraph& other) = default; |
| 41 | 50 |
| 42 TaskGraph::~TaskGraph() {} | 51 TaskGraph::~TaskGraph() {} |
| 43 | 52 |
| 44 void TaskGraph::Swap(TaskGraph* other) { | 53 void TaskGraph::Swap(TaskGraph* other) { |
| 45 nodes.swap(other->nodes); | 54 nodes.swap(other->nodes); |
| 46 edges.swap(other->edges); | 55 edges.swap(other->edges); |
| 47 } | 56 } |
| 48 | 57 |
| 49 void TaskGraph::Reset() { | 58 void TaskGraph::Reset() { |
| 50 nodes.clear(); | 59 nodes.clear(); |
| 51 edges.clear(); | 60 edges.clear(); |
| 52 } | 61 } |
| 53 | 62 |
| 54 } // namespace cc | 63 } // namespace cc |
| OLD | NEW |