Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: components/browser_sync/profile_sync_service.cc

Issue 2624943002: [Sync] Move snapshot cache from SBHI to PSS. (Closed)
Patch Set: Address comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/browser_sync/profile_sync_service.h ('k') | components/browser_sync/profile_sync_service_mock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/browser_sync/profile_sync_service.cc
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc
index c17718f64871c53878e870b9fa6bc8309f0fd5de..bccbad79eb2132d24d159d25566da9ad9fa1d576 100644
--- a/components/browser_sync/profile_sync_service.cc
+++ b/components/browser_sync/profile_sync_service.cc
@@ -782,7 +782,7 @@ void ProfileSyncService::ShutdownImpl(syncer::ShutdownReason reason) {
local_device_->Clear();
}
- // Clear various flags.
+ // Clear various state.
expect_sync_configuration_aborted_ = false;
is_auth_in_progress_ = false;
engine_initialized_ = false;
@@ -794,6 +794,7 @@ void ProfileSyncService::ShutdownImpl(syncer::ShutdownReason reason) {
catch_up_configure_in_progress_ = false;
access_token_.clear();
request_access_token_retry_timer_.Stop();
+ last_snapshot_ = syncer::SyncCycleSnapshot();
// Revert to "no auth error".
if (last_auth_error_.state() != GoogleServiceAuthError::NONE)
UpdateAuthErrorState(GoogleServiceAuthError::AuthErrorNone());
@@ -1023,10 +1024,16 @@ void ProfileSyncService::OnEngineInitialized(
RequestStart();
}
-void ProfileSyncService::OnSyncCycleCompleted() {
+void ProfileSyncService::OnSyncCycleCompleted(
+ const syncer::SyncCycleSnapshot& snapshot) {
DCHECK(thread_checker_.CalledOnValidThread());
+
+ last_snapshot_ = snapshot;
+
UpdateLastSyncedTime();
- const syncer::SyncCycleSnapshot snapshot = GetLastCycleSnapshot();
+ if (!snapshot.poll_finish_time().is_null())
+ sync_prefs_.SetLastPollTime(snapshot.poll_finish_time());
+
if (IsDataTypeControllerRunning(syncer::SESSIONS) &&
snapshot.model_neutral_state().get_updates_request_types.Has(
syncer::SESSIONS) &&
@@ -1866,9 +1873,7 @@ syncer::UserShare* ProfileSyncService::GetUserShare() const {
syncer::SyncCycleSnapshot ProfileSyncService::GetLastCycleSnapshot() const {
DCHECK(thread_checker_.CalledOnValidThread());
- if (engine_)
- return engine_->GetLastCycleSnapshot();
- return syncer::SyncCycleSnapshot();
+ return last_snapshot_;
}
bool ProfileSyncService::HasUnsyncedItems() const {
« no previous file with comments | « components/browser_sync/profile_sync_service.h ('k') | components/browser_sync/profile_sync_service_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698