Danil Chapovalov | 348b08a | 2019-01-17 13:07:25 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | #ifndef API_TASK_QUEUE_TASK_QUEUE_FACTORY_H_ |
| 11 | #define API_TASK_QUEUE_TASK_QUEUE_FACTORY_H_ |
| 12 | |
| 13 | #include <memory> |
| 14 | |
| 15 | #include "absl/strings/string_view.h" |
| 16 | #include "api/task_queue/task_queue_base.h" |
Danil Chapovalov | 348b08a | 2019-01-17 13:07:25 +0100 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
| 19 | |
Danil Chapovalov | d00405f | 2019-02-25 15:06:13 +0100 | [diff] [blame] | 20 | // The implementation of this interface must be thread-safe. |
Danil Chapovalov | 348b08a | 2019-01-17 13:07:25 +0100 | [diff] [blame] | 21 | class TaskQueueFactory { |
| 22 | public: |
| 23 | // TaskQueue priority levels. On some platforms these will map to thread |
| 24 | // priorities, on others such as Mac and iOS, GCD queue priorities. |
Danil Chapovalov | d00405f | 2019-02-25 15:06:13 +0100 | [diff] [blame] | 25 | enum class Priority { NORMAL = 0, HIGH, LOW }; |
Danil Chapovalov | 348b08a | 2019-01-17 13:07:25 +0100 | [diff] [blame] | 26 | |
| 27 | virtual ~TaskQueueFactory() = default; |
| 28 | virtual std::unique_ptr<TaskQueueBase, TaskQueueDeleter> CreateTaskQueue( |
| 29 | absl::string_view name, |
| 30 | Priority priority) const = 0; |
| 31 | }; |
| 32 | |
| 33 | } // namespace webrtc |
| 34 | |
| 35 | #endif // API_TASK_QUEUE_TASK_QUEUE_FACTORY_H_ |