Commit 9d43cb6e authored by Jeremy Roman's avatar Jeremy Roman Committed by Commit Bot

inspector: Drop usage of WTF::Mutex::TimedWait in favour of Wait.

This code only ever waits not at all (equivalent to doing nothing) or forever
(equivalent to using Wait), so drop TimedWait. This both makes the code simpler
and clearer, and drops the only usage of the WTF::Mutex "absolute time" semantics.
This helps clear the path for adopting base-style semantics for TimedWait instead.

Bug: 856641
Change-Id: I912b01b475173b965c7990cb4d3476c2eb21fae5
Reviewed-on: https://chromium-review.googlesource.com/1183592Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587698}
parent ab956a6f
......@@ -85,18 +85,15 @@ bool InspectorTaskRunner::IsRunningTask() {
InspectorTaskRunner::Task InspectorTaskRunner::TakeNextTask(
InspectorTaskRunner::WaitMode wait_mode) {
MutexLocker lock(mutex_);
bool timed_out = false;
static double infinite_time = std::numeric_limits<double>::max();
double absolute_time = wait_mode == kWaitForTask ? infinite_time : 0.0;
while (!disposed_ && !timed_out && queue_.IsEmpty())
timed_out = !condition_.TimedWait(mutex_, absolute_time);
DCHECK(!timed_out || absolute_time != infinite_time);
if (wait_mode == kWaitForTask) {
while (!disposed_ && queue_.IsEmpty())
condition_.Wait(mutex_);
}
if (disposed_ || timed_out)
if (disposed_ || queue_.IsEmpty())
return Task();
SECURITY_DCHECK(!queue_.IsEmpty());
return queue_.TakeFirst();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment