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

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

Issue 2631453002: Revert of cc: Add image decode queue functionality to image manager. (Closed)
Patch Set: 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
25 bool TaskState::IsScheduled() const { 21 bool TaskState::IsScheduled() const {
26 return value_ == Value::SCHEDULED; 22 return value_ == Value::SCHEDULED;
27 } 23 }
28 24
29 bool TaskState::IsRunning() const { 25 bool TaskState::IsRunning() const {
30 return value_ == Value::RUNNING; 26 return value_ == Value::RUNNING;
31 } 27 }
32 28
33 bool TaskState::IsFinished() const { 29 bool TaskState::IsFinished() const {
34 return value_ == Value::FINISHED; 30 return value_ == Value::FINISHED;
35 } 31 }
36 32
37 bool TaskState::IsCanceled() const { 33 bool TaskState::IsCanceled() const {
38 return value_ == Value::CANCELED; 34 return value_ == Value::CANCELED;
39 } 35 }
40 36
41 void TaskState::Reset() { 37 void TaskState::Reset() {
42 value_ = Value::NEW; 38 value_ = Value::NEW;
43 } 39 }
44 40
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
62 void TaskState::DidSchedule() { 41 void TaskState::DidSchedule() {
63 DCHECK(value_ == Value::NEW) 42 DCHECK(value_ == Value::NEW)
64 << "Task should be in NEW state to get scheduled."; 43 << "Task should be in NEW state to get scheduled.";
65 value_ = Value::SCHEDULED; 44 value_ = Value::SCHEDULED;
66 } 45 }
67 46
68 void TaskState::DidStart() { 47 void TaskState::DidStart() {
69 DCHECK(value_ == Value::SCHEDULED) 48 DCHECK(value_ == Value::SCHEDULED)
70 << "Task should be only in SCHEDULED state to start, that is it should " 49 << "Task should be only in SCHEDULED state to start, that is it should "
71 "not be started or finished."; 50 "not be started or finished.";
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 nodes.swap(other->nodes); 89 nodes.swap(other->nodes);
111 edges.swap(other->edges); 90 edges.swap(other->edges);
112 } 91 }
113 92
114 void TaskGraph::Reset() { 93 void TaskGraph::Reset() {
115 nodes.clear(); 94 nodes.clear();
116 edges.clear(); 95 edges.clear();
117 } 96 }
118 97
119 } // namespace cc 98 } // 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