• Wei Lee's avatar
    VCD: Fix the race condition when closing CameraAppDeviceImpl · d58e3784
    Wei Lee authored
    After https://crrev.com/c/2602969, |OnDeviceClosed()| might be triggered
    from different threads. But in |OnDeviceClosed()|, it will access
    |camera_app_devices_| and might introduce race condition.
    
    Therefore, to fix it, we can post the task to make sure that
    |OnDeviceClosed()| will be called on the same thread.
    
    And since now we will not call |OnDeviceClosed()| directly and the mojo
    error handler of a receiver set might be triggered more than once, we
    should also handle it properly.
    
    Bug: b/177191321
    Test: Consecutively passes CCAUISettings.swa for 20 times
    
    Change-Id: I93e546a98c410017f17071c97336bfe40dcc7b69
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2619247
    Commit-Queue: Wei Lee <wtlee@chromium.org>
    Commit-Queue: Shik Chen <shik@chromium.org>
    Auto-Submit: Wei Lee <wtlee@chromium.org>
    Reviewed-by: default avatarShik Chen <shik@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#841974}
    d58e3784
camera_app_device_impl.cc 10.7 KB