• Istiaque Ahmed's avatar
    Fix a leak in OneShotEvent class. · e2ea864f
    Istiaque Ahmed authored
    Once Signal()ed, OneShotEvent should drop all the references to
    the tasks, otherwise OneShotEvent::tasks_ would continue to hold
    references to users of OneShotEvent::Post(), for the lifetime
    of OneShotEvent.
    
    This CL clears |tasks_| once Signal() is called, dropping those
    references correctly. In future, OneShotEvent::Post() will take
    OnceClosure instead of (repeating) Closure.
    
    This CL also adds a regression test for the same.
    
    Bug: 853649
    Change-Id: I10270318ff8393a9af0b8da299a1866df936b273
    Reviewed-on: https://chromium-review.googlesource.com/1103606
    Commit-Queue: Istiaque Ahmed <lazyboy@chromium.org>
    Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#568184}
    e2ea864f
one_shot_event_unittest.cc 5.05 KB