[Sync:USS] Support BackendMigrator logic for USS Nigori
BackendMigrator logic requires resetting sync metadata for specific datatype. For regular datatypes, corresponding logic lives inside ModelAssociationManager and DataTypeManager, which don't have access to Nigori's ModelTypeController. For Directory implementation of Nigori this logic implemented through Directory::PurgeEntiesWithTypeIn(). We can detect required migration, because call of Directory::PurgeEntiesWithTypeIn() plumbed through SyncEngineBackend. We just restart ModelTypeController for Nigori and this triggers call of NigoriSyncBridge::ApplyDisableSyncChanges(). We keep in-memory state of explicit passphrase key loaded from the prefs, because we need it for future support of BackendMigrator for USS Nigori. It's safe, because if we stop due to disabling sync, we will also clear corresponding pref and we should not worry about in-memory state of the bridge, since we won't continue use the same instance. This is not perfect solution, and we need to try a better one. But for now all alternatives too intrusive (getting rid of ModelTypeController for Nigori or moving it into the UI thread). This CL allows passing Migration*ClientTest with enabled USS implementation of Nigori. Bug: 922900 Change-Id: I9f7b218dec46ebfcc21ad8093b73e3c019fd438f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1784606 Commit-Queue: Maksim Moskvitin <mmoskvitin@google.com> Reviewed-by:Mikel Astiz <mastiz@chromium.org> Cr-Commit-Position: refs/heads/master@{#693822}
Showing
Please register or sign in to comment