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