#include "test/time_controller/simulated_time_controller.h"
#include <algorithm>
#include <deque>
#include <list>
#include <memory>
#include <string>
#include <thread>
#include <vector>
#include "absl/strings/string_view.h"
#include "test/time_controller/simulated_task_queue.h"
#include "test/time_controller/simulated_thread.h"
namespace webrtc {
namespace {
template <class C>
bool RemoveByValue(C* vec, typename C::value_type val) { … }
}
namespace sim_time_impl {
SimulatedTimeControllerImpl::SimulatedTimeControllerImpl(Timestamp start_time)
: … { … }
SimulatedTimeControllerImpl::~SimulatedTimeControllerImpl() = default;
std::unique_ptr<TaskQueueBase, TaskQueueDeleter>
SimulatedTimeControllerImpl::CreateTaskQueue(
absl::string_view name,
TaskQueueFactory::Priority priority) const { … }
std::unique_ptr<rtc::Thread> SimulatedTimeControllerImpl::CreateThread(
const std::string& name,
std::unique_ptr<rtc::SocketServer> socket_server) { … }
void SimulatedTimeControllerImpl::YieldExecution() { … }
void SimulatedTimeControllerImpl::RunReadyRunners() { … }
Timestamp SimulatedTimeControllerImpl::CurrentTime() const { … }
Timestamp SimulatedTimeControllerImpl::NextRunTime() const { … }
void SimulatedTimeControllerImpl::AdvanceTime(Timestamp target_time) { … }
void SimulatedTimeControllerImpl::Register(SimulatedSequenceRunner* runner) { … }
void SimulatedTimeControllerImpl::Unregister(SimulatedSequenceRunner* runner) { … }
void SimulatedTimeControllerImpl::StartYield(TaskQueueBase* yielding_from) { … }
void SimulatedTimeControllerImpl::StopYield(TaskQueueBase* yielding_from) { … }
}
GlobalSimulatedTimeController::GlobalSimulatedTimeController(
Timestamp start_time)
: … { … }
GlobalSimulatedTimeController::~GlobalSimulatedTimeController() = default;
Clock* GlobalSimulatedTimeController::GetClock() { … }
TaskQueueFactory* GlobalSimulatedTimeController::GetTaskQueueFactory() { … }
std::unique_ptr<rtc::Thread> GlobalSimulatedTimeController::CreateThread(
const std::string& name,
std::unique_ptr<rtc::SocketServer> socket_server) { … }
rtc::Thread* GlobalSimulatedTimeController::GetMainThread() { … }
void GlobalSimulatedTimeController::AdvanceTime(TimeDelta duration) { … }
void GlobalSimulatedTimeController::SkipForwardBy(TimeDelta duration) { … }
void GlobalSimulatedTimeController::Register(
sim_time_impl::SimulatedSequenceRunner* runner) { … }
void GlobalSimulatedTimeController::Unregister(
sim_time_impl::SimulatedSequenceRunner* runner) { … }
}