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 | #include "test/time_controller/real_time_controller.h" |
| 11 | |
| 12 | #include "api/task_queue/global_task_queue_factory.h" |
| 13 | #include "rtc_base/event.h" |
| 14 | #include "rtc_base/task_utils/to_queued_task.h" |
| 15 | #include "system_wrappers/include/sleep.h" |
| 16 | |
| 17 | namespace webrtc { |
| 18 | |
| 19 | Clock* RealTimeController::GetClock() { |
| 20 | return Clock::GetRealTimeClock(); |
| 21 | } |
| 22 | |
| 23 | TaskQueueFactory* RealTimeController::GetTaskQueueFactory() { |
| 24 | return &GlobalTaskQueueFactory(); |
| 25 | } |
| 26 | |
| 27 | std::unique_ptr<ProcessThread> RealTimeController::CreateProcessThread( |
| 28 | const char* thread_name) { |
| 29 | return ProcessThread::Create(thread_name); |
| 30 | } |
| 31 | |
| 32 | void RealTimeController::Sleep(TimeDelta duration) { |
| 33 | SleepMs(duration.ms()); |
| 34 | } |
| 35 | |
| 36 | void RealTimeController::InvokeWithControlledYield( |
| 37 | std::function<void()> closure) { |
| 38 | closure(); |
| 39 | } |
| 40 | |
| 41 | } // namespace webrtc |