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

Side by Side Diff: cc/raster/task_graph_runner.cc

Issue 1890903002: cc: Simplify Task and its derived classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_tile_task_runner
Patch Set: nits 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 unified diff | Download patch
OLDNEW
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()
17 : type_id_(kDefaultTaskTypeId), will_run_(false), did_run_(false) {}
18
19 Task::~Task() {
20 DCHECK(!will_run_);
21 }
22
23 void Task::WillRun() {
24 DCHECK(!will_run_);
25 DCHECK(!did_run_);
26 will_run_ = true;
27 }
28
29 void Task::DidRun() {
30 DCHECK(will_run_);
31 will_run_ = false;
32 did_run_ = true;
33 }
34
35 bool Task::HasFinishedRunning() const {
36 return did_run_;
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
47 TaskGraph::TaskGraph() {} 16 TaskGraph::TaskGraph() {}
48 17
49 TaskGraph::TaskGraph(const TaskGraph& other) = default; 18 TaskGraph::TaskGraph(const TaskGraph& other) = default;
50 19
51 TaskGraph::~TaskGraph() {} 20 TaskGraph::~TaskGraph() {}
52 21
53 void TaskGraph::Swap(TaskGraph* other) { 22 void TaskGraph::Swap(TaskGraph* other) {
54 nodes.swap(other->nodes); 23 nodes.swap(other->nodes);
55 edges.swap(other->edges); 24 edges.swap(other->edges);
56 } 25 }
57 26
58 void TaskGraph::Reset() { 27 void TaskGraph::Reset() {
59 nodes.clear(); 28 nodes.clear();
60 edges.clear(); 29 edges.clear();
61 } 30 }
62 31
63 } // namespace cc 32 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698