| Index: base/synchronization/waitable_event_posix.cc
|
| diff --git a/base/synchronization/waitable_event_posix.cc b/base/synchronization/waitable_event_posix.cc
|
| index 696ffc7a02abe5a1c21e429032b217fd7f142c91..04a262b721d80186011c2d5e3370396805765d6c 100644
|
| --- a/base/synchronization/waitable_event_posix.cc
|
| +++ b/base/synchronization/waitable_event_posix.cc
|
| @@ -151,14 +151,14 @@ class SyncWaiter : public WaitableEvent::Waiter {
|
| };
|
|
|
| void WaitableEvent::Wait() {
|
| - bool result = TimedWait(TimeDelta::FromSeconds(-1));
|
| + bool result = TimedWait(TimeDelta::Max());
|
| DCHECK(result) << "TimedWait() should never fail with infinite timeout";
|
| }
|
|
|
| bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
|
| + DCHECK_GE(max_time, TimeDelta());
|
| base::ThreadRestrictions::AssertWaitAllowed();
|
| const TimeTicks end_time(TimeTicks::Now() + max_time);
|
| - const bool finite_time = max_time.ToInternalValue() >= 0;
|
|
|
| kernel_->lock_.Acquire();
|
| if (kernel_->signaled_) {
|
| @@ -184,7 +184,7 @@ bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
|
| for (;;) {
|
| const TimeTicks current_time(TimeTicks::Now());
|
|
|
| - if (sw.fired() || (finite_time && current_time >= end_time)) {
|
| + if (sw.fired() || current_time >= end_time) {
|
| const bool return_value = sw.fired();
|
|
|
| // We can't acquire @lock_ before releasing the SyncWaiter lock (because
|
| @@ -207,12 +207,7 @@ bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
|
| return return_value;
|
| }
|
|
|
| - if (finite_time) {
|
| - const TimeDelta max_wait(end_time - current_time);
|
| - sw.cv()->TimedWait(max_wait);
|
| - } else {
|
| - sw.cv()->Wait();
|
| - }
|
| + sw.cv()->TimedWait(end_time - current_time);
|
| }
|
| }
|
|
|
|
|