Sebastian Jansson | 0d617cc | 2019-03-22 15:22:16 +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 TEST_TIME_CONTROLLER_REAL_TIME_CONTROLLER_H_ |
| 11 | #define TEST_TIME_CONTROLLER_REAL_TIME_CONTROLLER_H_ |
| 12 | |
Danil Chapovalov | 28de7cf | 2019-04-12 19:25:06 +0200 | [diff] [blame] | 13 | #include <functional> |
Sebastian Jansson | 0d617cc | 2019-03-22 15:22:16 +0100 | [diff] [blame] | 14 | #include <memory> |
| 15 | |
Danil Chapovalov | 28de7cf | 2019-04-12 19:25:06 +0200 | [diff] [blame] | 16 | #include "api/task_queue/task_queue_factory.h" |
Bjorn A Mellem | c4f8654 | 2019-11-21 10:37:18 -0800 | [diff] [blame] | 17 | #include "api/test/time_controller.h" |
Danil Chapovalov | 28de7cf | 2019-04-12 19:25:06 +0200 | [diff] [blame] | 18 | #include "api/units/time_delta.h" |
Danil Chapovalov | 28de7cf | 2019-04-12 19:25:06 +0200 | [diff] [blame] | 19 | #include "system_wrappers/include/clock.h" |
Sebastian Jansson | 0d617cc | 2019-03-22 15:22:16 +0100 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | class RealTimeController : public TimeController { |
| 23 | public: |
Danil Chapovalov | 28de7cf | 2019-04-12 19:25:06 +0200 | [diff] [blame] | 24 | RealTimeController(); |
| 25 | |
Sebastian Jansson | 0d617cc | 2019-03-22 15:22:16 +0100 | [diff] [blame] | 26 | Clock* GetClock() override; |
| 27 | TaskQueueFactory* GetTaskQueueFactory() override; |
Sebastian Jansson | fc8279d | 2020-01-16 11:45:59 +0100 | [diff] [blame] | 28 | std::unique_ptr<rtc::Thread> CreateThread( |
| 29 | const std::string& name, |
| 30 | std::unique_ptr<rtc::SocketServer> socket_server) override; |
| 31 | rtc::Thread* GetMainThread() override; |
Markus Handell | 486cc55 | 2019-12-03 14:37:28 +0100 | [diff] [blame] | 32 | void AdvanceTime(TimeDelta duration) override; |
Danil Chapovalov | 28de7cf | 2019-04-12 19:25:06 +0200 | [diff] [blame] | 33 | |
| 34 | private: |
Sebastian Jansson | fc8279d | 2020-01-16 11:45:59 +0100 | [diff] [blame] | 35 | const std::unique_ptr<TaskQueueFactory> task_queue_factory_; |
Sebastian Jansson | 6ce033a | 2020-01-22 10:12:56 +0100 | [diff] [blame] | 36 | const std::unique_ptr<rtc::Thread> main_thread_; |
Sebastian Jansson | 0d617cc | 2019-03-22 15:22:16 +0100 | [diff] [blame] | 37 | }; |
| 38 | |
Sebastian Jansson | 0d617cc | 2019-03-22 15:22:16 +0100 | [diff] [blame] | 39 | } // namespace webrtc |
| 40 | |
| 41 | #endif // TEST_TIME_CONTROLLER_REAL_TIME_CONTROLLER_H_ |