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

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

Issue 2537683002: cc: Add image decode queue functionality to image manager. (Closed)
Patch Set: test fix Created 3 years, 11 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
« no previous file with comments | « cc/raster/task.h ('k') | cc/test/fake_layer_tree_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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.h" 5 #include "cc/raster/task.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 TaskState::TaskState() : value_(Value::NEW) {} 11 TaskState::TaskState() : value_(Value::NEW) {}
12 12
13 TaskState::~TaskState() { 13 TaskState::~TaskState() {
14 DCHECK(value_ != Value::RUNNING) 14 DCHECK(value_ != Value::RUNNING)
15 << "Running task should never get destroyed."; 15 << "Running task should never get destroyed.";
16 DCHECK(value_ == Value::FINISHED || value_ == Value::CANCELED) 16 DCHECK(value_ == Value::FINISHED || value_ == Value::CANCELED)
17 << "Task, if scheduled, should get concluded either in FINISHED or " 17 << "Task, if scheduled, should get concluded either in FINISHED or "
18 "CANCELED state."; 18 "CANCELED state.";
19 } 19 }
20 20
21 bool TaskState::IsNew() const {
22 return value_ == Value::NEW;
23 }
24
21 bool TaskState::IsScheduled() const { 25 bool TaskState::IsScheduled() const {
22 return value_ == Value::SCHEDULED; 26 return value_ == Value::SCHEDULED;
23 } 27 }
24 28
25 bool TaskState::IsRunning() const { 29 bool TaskState::IsRunning() const {
26 return value_ == Value::RUNNING; 30 return value_ == Value::RUNNING;
27 } 31 }
28 32
29 bool TaskState::IsFinished() const { 33 bool TaskState::IsFinished() const {
30 return value_ == Value::FINISHED; 34 return value_ == Value::FINISHED;
31 } 35 }
32 36
33 bool TaskState::IsCanceled() const { 37 bool TaskState::IsCanceled() const {
34 return value_ == Value::CANCELED; 38 return value_ == Value::CANCELED;
35 } 39 }
36 40
37 void TaskState::Reset() { 41 void TaskState::Reset() {
38 value_ = Value::NEW; 42 value_ = Value::NEW;
39 } 43 }
40 44
45 std::string TaskState::ToString() const {
46 switch (value_) {
47 case Value::NEW:
48 return "NEW";
49 case Value::SCHEDULED:
50 return "SCHEDULED";
51 case Value::RUNNING:
52 return "RUNNING";
53 case Value::FINISHED:
54 return "FINISHED";
55 case Value::CANCELED:
56 return "CANCELED";
57 }
58 NOTREACHED();
59 return "";
60 }
61
41 void TaskState::DidSchedule() { 62 void TaskState::DidSchedule() {
42 DCHECK(value_ == Value::NEW) 63 DCHECK(value_ == Value::NEW)
43 << "Task should be in NEW state to get scheduled."; 64 << "Task should be in NEW state to get scheduled.";
44 value_ = Value::SCHEDULED; 65 value_ = Value::SCHEDULED;
45 } 66 }
46 67
47 void TaskState::DidStart() { 68 void TaskState::DidStart() {
48 DCHECK(value_ == Value::SCHEDULED) 69 DCHECK(value_ == Value::SCHEDULED)
49 << "Task should be only in SCHEDULED state to start, that is it should " 70 << "Task should be only in SCHEDULED state to start, that is it should "
50 "not be started or finished."; 71 "not be started or finished.";
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 nodes.swap(other->nodes); 110 nodes.swap(other->nodes);
90 edges.swap(other->edges); 111 edges.swap(other->edges);
91 } 112 }
92 113
93 void TaskGraph::Reset() { 114 void TaskGraph::Reset() {
94 nodes.clear(); 115 nodes.clear();
95 edges.clear(); 116 edges.clear();
96 } 117 }
97 118
98 } // namespace cc 119 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster/task.h ('k') | cc/test/fake_layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698