• Gabriel Charette's avatar
    [WaitableEvent] Remove TimedWaitUntil · c2b3ac89
    Gabriel Charette authored
    It only had two callers and it'll become error prone once
    ScopedTaskEnvironment's MOCK_TIME mode always mocks TimeTicks::Now().
    TimeDelta based TimedWait()'s will remain real-time-all-the-time but
    TimeWaitUntil() could be passed
    TimeTicks::Now() + TimeDelta::FromSeconds(1) but wait forever or return
    right away because Now() is mocked and is effectively a random value
    compared to system time.
    
    Context for MOCK_TIME : https://chromium-review.googlesource.com/c/chromium/src/+/1707870
    
    This also enabled an opportunity to clean up the implementations
    to invoke TimeTicks::Now() even less than before. All system calls
    for waiting are based on delta. So we always use the initial
    |wait_delta| and we only need to lookup Now() if the API can
    spuriously return too early and |wait_delta| isn't Max().
    
    R=kylechar@chromium.org
    
    Bug: 905412
    Change-Id: Ic73ee7ea286d023d2adee624478ff650f94767a3
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1708841Reviewed-by: default avatarkylechar <kylechar@chromium.org>
    Reviewed-by: default avatarJoe Mason <joenotcharles@google.com>
    Commit-Queue: Gabriel Charette <gab@chromium.org>
    Auto-Submit: Gabriel Charette <gab@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#682232}
    c2b3ac89
waitable_event.h 11.1 KB