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" |
| 17 | #include "api/units/time_delta.h" |
| 18 | #include "modules/utility/include/process_thread.h" |
| 19 | #include "system_wrappers/include/clock.h" |
Sebastian Jansson | 0d617cc | 2019-03-22 15:22:16 +0100 | [diff] [blame] | 20 | #include "test/time_controller/time_controller.h" |
| 21 | |
| 22 | namespace webrtc { |
| 23 | class RealTimeController : public TimeController { |
| 24 | public: |
Danil Chapovalov | 28de7cf | 2019-04-12 19:25:06 +0200 | [diff] [blame^] | 25 | RealTimeController(); |
| 26 | |
Sebastian Jansson | 0d617cc | 2019-03-22 15:22:16 +0100 | [diff] [blame] | 27 | Clock* GetClock() override; |
| 28 | TaskQueueFactory* GetTaskQueueFactory() override; |
| 29 | std::unique_ptr<ProcessThread> CreateProcessThread( |
| 30 | const char* thread_name) override; |
| 31 | void Sleep(TimeDelta duration) override; |
| 32 | void InvokeWithControlledYield(std::function<void()> closure) override; |
Danil Chapovalov | 28de7cf | 2019-04-12 19:25:06 +0200 | [diff] [blame^] | 33 | |
| 34 | private: |
| 35 | std::unique_ptr<TaskQueueFactory> task_queue_factory_; |
Sebastian Jansson | 0d617cc | 2019-03-22 15:22:16 +0100 | [diff] [blame] | 36 | }; |
| 37 | |
Sebastian Jansson | 5d97f55 | 2019-04-15 14:43:03 +0200 | [diff] [blame] | 38 | RealTimeController* GlobalRealTimeController(); |
| 39 | |
Sebastian Jansson | 0d617cc | 2019-03-22 15:22:16 +0100 | [diff] [blame] | 40 | } // namespace webrtc |
| 41 | |
| 42 | #endif // TEST_TIME_CONTROLLER_REAL_TIME_CONTROLLER_H_ |