blob: 58d7682d6fa10d25c4215d18735fd3c369f93b3e [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;
Markus Handell486cc552019-12-03 14:37:28 +010031 void AdvanceTime(TimeDelta duration) override;
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010032 void InvokeWithControlledYield(std::function<void()> closure) override;
Bjorn A Mellemc4f86542019-11-21 10:37:18 -080033 rtc::YieldInterface* YieldInterface() override;
Danil Chapovalov28de7cf2019-04-12 19:25:06 +020034
35 private:
36 std::unique_ptr<TaskQueueFactory> task_queue_factory_;
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010037};
38
Sebastian Jansson5d97f552019-04-15 14:43:03 +020039RealTimeController* GlobalRealTimeController();
40
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010041} // namespace webrtc
42
43#endif // TEST_TIME_CONTROLLER_REAL_TIME_CONTROLLER_H_