blob: f68fe441d57a73d638985f37aa1dda0ccd456982 [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"
19#include "modules/utility/include/process_thread.h"
20#include "system_wrappers/include/clock.h"
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010021
22namespace webrtc {
23class RealTimeController : public TimeController {
24 public:
Danil Chapovalov28de7cf2019-04-12 19:25:06 +020025 RealTimeController();
26
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010027 Clock* GetClock() override;
28 TaskQueueFactory* GetTaskQueueFactory() override;
29 std::unique_ptr<ProcessThread> CreateProcessThread(
30 const char* thread_name) override;
Sebastian Janssonfc8279d2020-01-16 11:45:59 +010031 std::unique_ptr<rtc::Thread> CreateThread(
32 const std::string& name,
33 std::unique_ptr<rtc::SocketServer> socket_server) override;
34 rtc::Thread* GetMainThread() override;
Markus Handell486cc552019-12-03 14:37:28 +010035 void AdvanceTime(TimeDelta duration) override;
Danil Chapovalov28de7cf2019-04-12 19:25:06 +020036
37 private:
Sebastian Janssonfc8279d2020-01-16 11:45:59 +010038 const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010039};
40
Sebastian Jansson5d97f552019-04-15 14:43:03 +020041RealTimeController* GlobalRealTimeController();
42
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010043} // namespace webrtc
44
45#endif // TEST_TIME_CONTROLLER_REAL_TIME_CONTROLLER_H_