real_time_controller.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  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. #include <functional>
  13. #include <memory>
  14. #include "api/task_queue/task_queue_factory.h"
  15. #include "api/test/time_controller.h"
  16. #include "api/units/time_delta.h"
  17. #include "modules/utility/include/process_thread.h"
  18. #include "system_wrappers/include/clock.h"
  19. namespace webrtc {
  20. class RealTimeController : public TimeController {
  21. public:
  22. RealTimeController();
  23. Clock* GetClock() override;
  24. TaskQueueFactory* GetTaskQueueFactory() override;
  25. std::unique_ptr<ProcessThread> CreateProcessThread(
  26. const char* thread_name) override;
  27. std::unique_ptr<rtc::Thread> CreateThread(
  28. const std::string& name,
  29. std::unique_ptr<rtc::SocketServer> socket_server) override;
  30. rtc::Thread* GetMainThread() override;
  31. void AdvanceTime(TimeDelta duration) override;
  32. private:
  33. const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
  34. const std::unique_ptr<rtc::Thread> main_thread_;
  35. };
  36. } // namespace webrtc
  37. #endif // TEST_TIME_CONTROLLER_REAL_TIME_CONTROLLER_H_