• Rushan Suleymanov's avatar
    Reland "Unify clearing of sync prefs" · e4827359
    Rushan Suleymanov authored
    This reverts commit 232ad148.
    
    Reason for revert: this patch was reverted in crrev.com/c/2043451 due to suspect of sync protocol violation. It was fixed in crrev.com/c/2061751.
    
    Original change's description:
    > Revert "Unify clearing of sync prefs"
    > 
    > This reverts commit 44d3aa82.
    > 
    > Reason for revert: suspect of running into sync protocol violations and the corresponding DCHECK failures.
    > 
    > Original change's description:
    > > Unify clearing of sync prefs
    > > 
    > > SyncPrefs is a thin layer on top of preferences and hosts two groups
    > > of preferences:
    > > 1) Actual user-facing settings, such as type-selection, exposed via
    > >    SyncUserSettings.
    > > 2) Local "bookkeeping" sync metadata, such the last synced time or the
    > >    client ID (cache GUID).
    > > 
    > > In addition, there are two cases that fall somewhere in the middle,
    > > whose behavior is changed in this patch:
    > > a) FirstSetupComplete: which roughly represents the user having
    > >    consented to sync-the-feature (as opposed to transport-only upon
    > >    sign-in without explicit user consent).
    > > b) The encryption-bootstrap-token: which represent an explicit
    > >    passphrase (usually custom passphrase) entered by the user, that
    > >    allows decrypting the incoming sync changes and encrypt outgoing
    > >    ones.
    > > 
    > > The last two preferences above fit group 1 better, so this patch stops
    > > clearing them in SyncPrefs::ClearPreferences(), now renamed to
    > > SyncPrefs::ClearLocalSyncTransportData().
    > > 
    > > With such cleanup, what used to be
    > > ClearDirectoryConsistencyPreferences() is now merged into a single
    > > clearing function, ClearLocalSyncTransportData(), and all calling sites
    > > are unified by directly clearing prefs in ShutdownImpl(DISABLE_SYNC), as
    > > opposed to individual calling sites.
    > > 
    > > This introduces -arguably desirable- behavioral changes because
    > > codepaths like RESET_LOCAL_SYNC_DATA or STOP_SYNC_FOR_DISABLED_ACCOUNT
    > > now actually clear all local metadata, which most notably includes
    > > keystore keys.
    > > 
    > > Change-Id: I2c42f98c4e068c7e340580d0b78a5cd5b5c46171
    > > Bug: 1046237
    > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023649
    > > Commit-Queue: Mikel Astiz <mastiz@chromium.org>
    > > Reviewed-by: Marc Treib <treib@chromium.org>
    > > Cr-Commit-Position: refs/heads/master@{#735841}
    > 
    > TBR=treib@chromium.org,mastiz@chromium.org
    > 
    > # Not skipping CQ checks because original CL landed > 1 day ago.
    > 
    > Bug: 1046237, 1048771
    > Change-Id: I4ce9e941f12aa58b7b6b286e990e74a1e01dad69
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2043451
    > Commit-Queue: Rushan Suleymanov <rushans@google.com>
    > Reviewed-by: Mikel Astiz <mastiz@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#739374}
    
    TBR=treib@chromium.org,mastiz@chromium.org,rushans@google.com
    
    # Not skipping CQ checks because original CL landed > 1 day ago.
    
    Bug: 1046237, 1048771
    Change-Id: Idfad70ab9b1c00f56dc8e78257fc1a75fc71466f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2066726Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
    Commit-Queue: Rushan Suleymanov <rushans@google.com>
    Cr-Commit-Position: refs/heads/master@{#743896}
    e4827359
sync_prefs_unittest.cc 28.5 KB