blob: f2d73bef37bbb23b600f25968b06aeb297fab9b6 [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"
17#include "api/units/time_delta.h"
18#include "modules/utility/include/process_thread.h"
19#include "system_wrappers/include/clock.h"
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010020#include "test/time_controller/time_controller.h"
21
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;
31 void Sleep(TimeDelta duration) override;
32 void InvokeWithControlledYield(std::function<void()> closure) override;
Danil Chapovalov28de7cf2019-04-12 19:25:06 +020033
34 private:
35 std::unique_ptr<TaskQueueFactory> task_queue_factory_;
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010036};
37
Sebastian Jansson5d97f552019-04-15 14:43:03 +020038RealTimeController* GlobalRealTimeController();
39
Sebastian Jansson0d617cc2019-03-22 15:22:16 +010040} // namespace webrtc
41
42#endif // TEST_TIME_CONTROLLER_REAL_TIME_CONTROLLER_H_