blob: 5f02eaf85fb316a03f4cce993eccfdaf4e7b9916 [file] [log] [blame]
Sebastian Jansson0d617cc2019-03-22 15:22:16 +01001/*
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 Chapovalov28de7cf2019-04-12 19:25:06 +020013#include <functional>
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010014#include <memory>
15
Danil Chapovalov28de7cf2019-04-12 19:25:06 +020016#include "api/task_queue/task_queue_factory.h"
Bjorn A Mellemc4f86542019-11-21 10:37:18 -080017#include "api/test/time_controller.h"
Danil Chapovalov28de7cf2019-04-12 19:25:06 +020018#include "api/units/time_delta.h"
Danil Chapovalov28de7cf2019-04-12 19:25:06 +020019#include "system_wrappers/include/clock.h"
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010020
21namespace webrtc {
22class RealTimeController : public TimeController {
23 public:
Danil Chapovalov28de7cf2019-04-12 19:25:06 +020024 RealTimeController();
25
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010026 Clock* GetClock() override;
27 TaskQueueFactory* GetTaskQueueFactory() override;
Sebastian Janssonfc8279d2020-01-16 11:45:59 +010028 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 Handell486cc552019-12-03 14:37:28 +010032 void AdvanceTime(TimeDelta duration) override;
Danil Chapovalov28de7cf2019-04-12 19:25:06 +020033
34 private:
Sebastian Janssonfc8279d2020-01-16 11:45:59 +010035 const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
Sebastian Jansson6ce033a2020-01-22 10:12:56 +010036 const std::unique_ptr<rtc::Thread> main_thread_;
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010037};
38
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010039} // namespace webrtc
40
41#endif // TEST_TIME_CONTROLLER_REAL_TIME_CONTROLLER_H_