| 1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef FLUTTER_FML_TASK_QUEUE_ID_H_ |
| 6 | #define FLUTTER_FML_TASK_QUEUE_ID_H_ |
| 7 | |
| 8 | #include "flutter/fml/logging.h" |
| 9 | |
| 10 | namespace fml { |
| 11 | |
| 12 | /** |
| 13 | * `MessageLoopTaskQueues` task dispatcher's internal task queue identifier. |
| 14 | */ |
| 15 | class TaskQueueId { |
| 16 | public: |
| 17 | /// This constant indicates whether a task queue has been subsumed by a task |
| 18 | /// runner. |
| 19 | static const size_t kUnmerged; |
| 20 | |
| 21 | /// Intializes a task queue with the given value as it's ID. |
| 22 | explicit TaskQueueId(size_t value) : value_(value) {} |
| 23 | |
| 24 | operator size_t() const { // NOLINT(google-explicit-constructor) |
| 25 | return value_; |
| 26 | } |
| 27 | |
| 28 | private: |
| 29 | size_t value_ = kUnmerged; |
| 30 | }; |
| 31 | |
| 32 | } // namespace fml |
| 33 | |
| 34 | #endif // FLUTTER_FML_TASK_QUEUE_ID_H_ |
| 35 | |