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 <iomanip> | |
prashant.n
2016/03/11 17:49:35
Remove.
| |
8 #include <utility> | 9 #include <utility> |
9 | 10 |
10 #include "base/atomic_sequence_num.h" | 11 #include "base/atomic_sequence_num.h" |
11 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
12 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
13 | 14 |
14 namespace cc { | 15 namespace cc { |
15 | 16 |
16 Task::Task() : will_run_(false), did_run_(false) {} | 17 Task::Task() : worker_(nullptr), 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 |
23 void Task::AttachWorker(TaskWorker* worker) { | |
prashant.n
2016/03/11 17:49:35
AttachTaskWorker/DetachTaskWorker
| |
24 DCHECK(!will_run_); | |
25 DCHECK(!did_run_); | |
26 worker_ = worker; | |
27 } | |
28 void Task::DetachWorker() { | |
29 DCHECK(did_run_); | |
30 worker_->TaskDone(); | |
31 worker_ = nullptr; | |
32 } | |
33 | |
22 void Task::WillRun() { | 34 void Task::WillRun() { |
23 DCHECK(!will_run_); | 35 DCHECK(!will_run_); |
24 DCHECK(!did_run_); | 36 DCHECK(!did_run_); |
25 will_run_ = true; | 37 will_run_ = true; |
26 } | 38 } |
27 | 39 |
28 void Task::DidRun() { | 40 void Task::DidRun() { |
29 DCHECK(will_run_); | 41 DCHECK(will_run_); |
30 will_run_ = false; | 42 will_run_ = false; |
31 did_run_ = true; | 43 did_run_ = true; |
(...skipping 13 matching lines...) Expand all Loading... | |
45 nodes.swap(other->nodes); | 57 nodes.swap(other->nodes); |
46 edges.swap(other->edges); | 58 edges.swap(other->edges); |
47 } | 59 } |
48 | 60 |
49 void TaskGraph::Reset() { | 61 void TaskGraph::Reset() { |
50 nodes.clear(); | 62 nodes.clear(); |
51 edges.clear(); | 63 edges.clear(); |
52 } | 64 } |
53 | 65 |
54 } // namespace cc | 66 } // namespace cc |
OLD | NEW |