Rename done() into condition(), because it is actually condition in TimeController API

Bug: None
Change-Id: Ia3a742d1d2ad1238223f4da7ae843a8d22108ec5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174060
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31144}
This commit is contained in:
Artem Titov
2020-04-29 11:09:59 +02:00
committed by Commit Bot
parent 91aa73255e
commit b5a013815f
2 changed files with 6 additions and 5 deletions

View File

@ -26,7 +26,7 @@ std::unique_ptr<TaskQueueFactory> TimeController::CreateTaskQueueFactory() {
};
return std::make_unique<FactoryWrapper>(GetTaskQueueFactory());
}
bool TimeController::Wait(const std::function<bool()>& done,
bool TimeController::Wait(const std::function<bool()>& condition,
TimeDelta max_duration) {
// Step size is chosen to be short enough to not significantly affect latency
// in real time tests while being long enough to avoid adding too much load to
@ -34,10 +34,10 @@ bool TimeController::Wait(const std::function<bool()>& done,
const auto kStep = TimeDelta::Millis(5);
for (auto elapsed = TimeDelta::Zero(); elapsed < max_duration;
elapsed += kStep) {
if (done())
if (condition())
return true;
AdvanceTime(kStep);
}
return done();
return condition();
}
} // namespace webrtc

View File

@ -57,8 +57,9 @@ class TimeController {
// for the given |duration|.
virtual void AdvanceTime(TimeDelta duration) = 0;
// Waits until done() == true, polling done() in small time intervals.
bool Wait(const std::function<bool()>& done,
// Waits until condition() == true, polling condition() in small time
// intervals.
bool Wait(const std::function<bool()>& condition,
TimeDelta max_duration = TimeDelta::Seconds(5));
};