Fix replying to OnSyncStarting() early for cache GUID mismatches
OnSyncStarting() should be completed (replied to) when a model is ready to sync and the initial sync metadata has been loaded. This is important to honor the processor's invariant that no remote changes are expected (from the worker) unless the model is ready to sync. For the (unlikely) case where OnSyncStarting() detects a cache GUID mismatch (e.g. database in a corrupt state), *AND* the bridge becomes unready to sync (currently the case for SESSIONS) as a reaction to that, we should make sure no reply is issued for OnSyncStarting() until the model becomes ready to sync. Specifically, for SESSIONS (SessionSyncBridge), this scenario could lead to MergeSyncData() being called too early, before the model was ready to handle it, running into DCHECKs (for DCHECK-enabled builds) or crashes. This becomes more likely if the UssMigrator is exercised (i.e. clients that transition from the directory-based sessions implementation to the USS implementation for the first time), because the migrator mimics a response from the server that is very fast (no actual network involved). Bug: 876490 Change-Id: I83e851fbbff235bb49ee03fd7f98d9764830ed83 Reviewed-on: https://chromium-review.googlesource.com/1256565 Commit-Queue: Mikel Astiz <mastiz@chromium.org> Reviewed-by:Mohamed Amir Yosef <mamir@chromium.org> Cr-Commit-Position: refs/heads/master@{#595783}
Showing
Please register or sign in to comment