2019-03-22 15:22:16 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright 2019 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
#include "test/time_controller/real_time_controller.h"
|
|
|
|
|
|
2019-04-12 19:25:06 +02:00
|
|
|
#include "api/task_queue/default_task_queue_factory.h"
|
2019-03-22 15:22:16 +01:00
|
|
|
#include "system_wrappers/include/sleep.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2019-04-12 19:25:06 +02:00
|
|
|
RealTimeController::RealTimeController()
|
|
|
|
|
: task_queue_factory_(CreateDefaultTaskQueueFactory()) {}
|
|
|
|
|
|
2019-03-22 15:22:16 +01:00
|
|
|
Clock* RealTimeController::GetClock() {
|
|
|
|
|
return Clock::GetRealTimeClock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TaskQueueFactory* RealTimeController::GetTaskQueueFactory() {
|
2019-04-12 19:25:06 +02:00
|
|
|
return task_queue_factory_.get();
|
2019-03-22 15:22:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<ProcessThread> RealTimeController::CreateProcessThread(
|
|
|
|
|
const char* thread_name) {
|
|
|
|
|
return ProcessThread::Create(thread_name);
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-03 14:37:28 +01:00
|
|
|
void RealTimeController::AdvanceTime(TimeDelta duration) {
|
2019-03-22 15:22:16 +01:00
|
|
|
SleepMs(duration.ms());
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-15 14:43:03 +02:00
|
|
|
RealTimeController* GlobalRealTimeController() {
|
|
|
|
|
static RealTimeController* time_controller = new RealTimeController();
|
|
|
|
|
return time_controller;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-22 15:22:16 +01:00
|
|
|
} // namespace webrtc
|