OLD | NEW |
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 #ifndef CC_RASTER_TASK_H_ | 5 #ifndef CC_RASTER_TASK_H_ |
6 #define CC_RASTER_TASK_H_ | 6 #define CC_RASTER_TASK_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | |
11 #include <vector> | 10 #include <vector> |
12 | 11 |
13 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
14 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
15 | 14 |
16 namespace cc { | 15 namespace cc { |
17 class Task; | 16 class Task; |
18 | 17 |
19 // This class provides states to manage life cycle of a task and given below is | 18 // This class provides states to manage life cycle of a task and given below is |
20 // how it is used by TaskGraphWorkQueue to process life cycle of a task. | 19 // how it is used by TaskGraphWorkQueue to process life cycle of a task. |
(...skipping 11 matching lines...) Expand all Loading... |
32 // ┌───────────┐ ╔══════════╗ | 31 // ┌───────────┐ ╔══════════╗ |
33 // │ SCHEDULED │------> ║ CANCELED ║ | 32 // │ SCHEDULED │------> ║ CANCELED ║ |
34 // └───────────┘ ╚══════════╝ | 33 // └───────────┘ ╚══════════╝ |
35 // | | 34 // | |
36 // v | 35 // v |
37 // ┌─────────┐ ╔══════════╗ | 36 // ┌─────────┐ ╔══════════╗ |
38 // │ RUNNING │-------> ║ FINISHED ║ | 37 // │ RUNNING │-------> ║ FINISHED ║ |
39 // └─────────┘ ╚══════════╝ | 38 // └─────────┘ ╚══════════╝ |
40 class CC_EXPORT TaskState { | 39 class CC_EXPORT TaskState { |
41 public: | 40 public: |
42 bool IsNew() const; | |
43 bool IsScheduled() const; | 41 bool IsScheduled() const; |
44 bool IsRunning() const; | 42 bool IsRunning() const; |
45 bool IsFinished() const; | 43 bool IsFinished() const; |
46 bool IsCanceled() const; | 44 bool IsCanceled() const; |
47 | 45 |
48 // Functions to change the state of task. These functions should be called | 46 // Functions to change the state of task. These functions should be called |
49 // only from TaskGraphWorkQueue where the life cycle of a task is decided or | 47 // only from TaskGraphWorkQueue where the life cycle of a task is decided or |
50 // from tests. These functions are not thread-safe. Caller is responsible for | 48 // from tests. These functions are not thread-safe. Caller is responsible for |
51 // thread safety. | 49 // thread safety. |
52 void Reset(); // Sets state to NEW. | 50 void Reset(); // Sets state to NEW. |
53 void DidSchedule(); | 51 void DidSchedule(); |
54 void DidStart(); | 52 void DidStart(); |
55 void DidFinish(); | 53 void DidFinish(); |
56 void DidCancel(); | 54 void DidCancel(); |
57 | 55 |
58 std::string ToString() const; | |
59 | |
60 private: | 56 private: |
61 friend class Task; | 57 friend class Task; |
62 | 58 |
63 // Let only Task class create the TaskState. | 59 // Let only Task class create the TaskState. |
64 TaskState(); | 60 TaskState(); |
65 ~TaskState(); | 61 ~TaskState(); |
66 | 62 |
67 enum class Value : uint16_t { NEW, SCHEDULED, RUNNING, FINISHED, CANCELED }; | 63 enum class Value : uint16_t { NEW, SCHEDULED, RUNNING, FINISHED, CANCELED }; |
68 | 64 |
69 Value value_; | 65 Value value_; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 Node::Vector nodes; | 139 Node::Vector nodes; |
144 Edge::Vector edges; | 140 Edge::Vector edges; |
145 | 141 |
146 private: | 142 private: |
147 DISALLOW_COPY_AND_ASSIGN(TaskGraph); | 143 DISALLOW_COPY_AND_ASSIGN(TaskGraph); |
148 }; | 144 }; |
149 | 145 |
150 } // namespace cc | 146 } // namespace cc |
151 | 147 |
152 #endif // CC_RASTER_TASK_H_ | 148 #endif // CC_RASTER_TASK_H_ |
OLD | NEW |