• mhasank's avatar
    login: ignore new subscribers in concierge_client during events · 18c4ffcb
    mhasank authored
    This is spin-off from https://crrev.com/c/2381050 and addressess the same re-entrancy problem for arcvm
    
    ConciergeClient::Observer is implemented by arc_vm_client_adapter.cc and crostini_stability_monitor.cc
    arc_vm_client_adapter.cc has the same issue as the container so the TEST below ensures that the change is same
    crostini_stability_monitor.cc is only firing metric
    
    ConciergeClient::VmObserver is implemented by arc_vm_client_adapter.cc, lock_to_single_user_manager.cc, crostini_manager.cc, cros_usb_detector.cc and arc_session_manager.cc
    I checked all the consumers and I don't see anything registering another observer in the event handler
    
    ConciergeClient::ContainerObserver is implemented by CrostiniManager
    when CrostiniManager gets OnContainerStartupFailed, it fires a callback as well
    The callback is ultimately StartLxdContainerFinished which then fires OnContainerStarted (in case of failure) on its own observer
    Which is implemented by CrostiniInstaller in which it fires its own callback that comes from Install method which seems to be only used in unit tests.
    
    ConciergeClient::DiskImageObserver is implemented by CrostiniDisk and PluginVMInstaller
    
    CrostiniDisk registers callback in OnResize which is a callback of ResizeDiskImage
    ResizeDiskImage is called in OnVMRunning which is a callback for ResizeCrostiniDisk which is called by CrostiniHandler::HandleResizeCrostiniDisk and ResolveResizeCrostiniDiskCallback is the callback that ultimately gets fired
    which invokes a javascript function
    
    PluginVMInstaller registers itself in OnConceirgeAvailable
    In the event handler, the PluginVMInstaller fires its own observer which is implmeented by PluginVmInstallerView which only updates the labels on UI.
    
    I don't see any place where we're adding another observer during these callbacks which would need to receive the same event that is currently being observed therefore the change is safe.
    
    BUG=b:164816080
    TEST=deploy to dut, disable playstore, re-enable playstore, successfully finish the authorization flow
    TEST=deploy to dut, turn on crostini, successfully launch terminal, turn off crostini
    
    Change-Id: Ida55a24b04f87053bcfb7c958b63cc0ea883fa33
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2389060
    Commit-Queue: Muhammad Hasan Khan <mhasank@chromium.org>
    Reviewed-by: default avatarRyo Hashimoto <hashimoto@chromium.org>
    Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
    Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#805382}
    18c4ffcb
concierge_client.cc 16.8 KB