-
Mikel Astiz authored
The process of stopping a datatype is asynchronous by nature, most prominently in USS where we want to take special care about sync metadata being cleared. Prior to this patch, ModelTypeController could silently drop stop events, which could lead to the DataTypeManager (effectively the UI) think a datatype is stopped, while in reality it could remain running. This is problematic in multiple ways, most importantly due to the risk of leaking sync metadata or even data. Instead, what we want is that calls to OnSyncStarting() always have a corresponding StopSync(), and guarantee that OnSyncStarting() is not called twice without a StopSync() call in between. In order to do that, ModelTypeController now enters state STOPPING if the Stop() cannot be immediately executed, because it's currently STARTING. Once the start is finalized, stop is immediately issued and the corresponding callback informed, which allows ModelAssociationManager to continue its job. Bug: 855375 Change-Id: I6e22940fcb56816c43181c34e04c4a6e53c70a21 Reviewed-on: https://chromium-review.googlesource.com/1122863 Commit-Queue: Mikel Astiz <mastiz@chromium.org> Reviewed-by:
Marc Treib <treib@chromium.org> Cr-Commit-Position: refs/heads/master@{#572555}
23919ce6