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

Side by Side Diff: components/browser_sync/profile_sync_service.cc

Issue 2624943002: [Sync] Move snapshot cache from SBHI to PSS. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/browser_sync/profile_sync_service.h" 5 #include "components/browser_sync/profile_sync_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 OnGaiaAccountsInCookieUpdated(accounts, signed_out_accounts, error); 1016 OnGaiaAccountsInCookieUpdated(accounts, signed_out_accounts, error);
1017 } 1017 }
1018 1018
1019 NotifyObservers(); 1019 NotifyObservers();
1020 1020
1021 // Nobody will call us to start if no sign in is going to happen. 1021 // Nobody will call us to start if no sign in is going to happen.
1022 if (IsLocalSyncEnabled()) 1022 if (IsLocalSyncEnabled())
1023 RequestStart(); 1023 RequestStart();
1024 } 1024 }
1025 1025
1026 void ProfileSyncService::OnSyncCycleCompleted() { 1026 void ProfileSyncService::OnSyncCycleCompleted(
1027 const syncer::SyncCycleSnapshot& snapshot) {
1027 DCHECK(thread_checker_.CalledOnValidThread()); 1028 DCHECK(thread_checker_.CalledOnValidThread());
1029
1030 last_snapshot_ = snapshot;
1031
1028 UpdateLastSyncedTime(); 1032 UpdateLastSyncedTime();
1029 const syncer::SyncCycleSnapshot snapshot = GetLastCycleSnapshot(); 1033 if (!snapshot.poll_finish_time().is_null())
1034 sync_prefs_.SetLastPollTime(snapshot.poll_finish_time());
1035
1030 if (IsDataTypeControllerRunning(syncer::SESSIONS) && 1036 if (IsDataTypeControllerRunning(syncer::SESSIONS) &&
1031 snapshot.model_neutral_state().get_updates_request_types.Has( 1037 snapshot.model_neutral_state().get_updates_request_types.Has(
1032 syncer::SESSIONS) && 1038 syncer::SESSIONS) &&
1033 !syncer::HasSyncerError(snapshot.model_neutral_state())) { 1039 !syncer::HasSyncerError(snapshot.model_neutral_state())) {
1034 // Trigger garbage collection of old sessions now that we've downloaded 1040 // Trigger garbage collection of old sessions now that we've downloaded
1035 // any new session data. 1041 // any new session data.
1036 base::ThreadTaskRunnerHandle::Get()->PostTask( 1042 base::ThreadTaskRunnerHandle::Get()->PostTask(
1037 FROM_HERE, base::Bind(&SessionsSyncManager::DoGarbageCollection, 1043 FROM_HERE, base::Bind(&SessionsSyncManager::DoGarbageCollection,
1038 base::AsWeakPtr(sessions_sync_manager_.get()))); 1044 base::AsWeakPtr(sessions_sync_manager_.get())));
1039 } 1045 }
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 DCHECK(thread_checker_.CalledOnValidThread()); 1865 DCHECK(thread_checker_.CalledOnValidThread());
1860 if (engine_ && engine_initialized_) { 1866 if (engine_ && engine_initialized_) {
1861 return engine_->GetUserShare(); 1867 return engine_->GetUserShare();
1862 } 1868 }
1863 NOTREACHED(); 1869 NOTREACHED();
1864 return nullptr; 1870 return nullptr;
1865 } 1871 }
1866 1872
1867 syncer::SyncCycleSnapshot ProfileSyncService::GetLastCycleSnapshot() const { 1873 syncer::SyncCycleSnapshot ProfileSyncService::GetLastCycleSnapshot() const {
1868 DCHECK(thread_checker_.CalledOnValidThread()); 1874 DCHECK(thread_checker_.CalledOnValidThread());
1869 if (engine_) 1875 return last_snapshot_;
pavely 2017/01/12 00:27:13 Previously if user signs out this method would ret
maxbogue 2017/01/12 01:55:02 Hmm... I'm going to clear it in ShutdownImpl just
1870 return engine_->GetLastCycleSnapshot();
1871 return syncer::SyncCycleSnapshot();
1872 } 1876 }
1873 1877
1874 bool ProfileSyncService::HasUnsyncedItems() const { 1878 bool ProfileSyncService::HasUnsyncedItems() const {
1875 DCHECK(thread_checker_.CalledOnValidThread()); 1879 DCHECK(thread_checker_.CalledOnValidThread());
1876 if (HasSyncingEngine() && engine_initialized_) { 1880 if (HasSyncingEngine() && engine_initialized_) {
1877 return engine_->HasUnsyncedItems(); 1881 return engine_->HasUnsyncedItems();
1878 } 1882 }
1879 NOTREACHED(); 1883 NOTREACHED();
1880 return false; 1884 return false;
1881 } 1885 }
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 2632
2629 DCHECK(startup_controller_->IsSetupInProgress()); 2633 DCHECK(startup_controller_->IsSetupInProgress());
2630 startup_controller_->SetSetupInProgress(false); 2634 startup_controller_->SetSetupInProgress(false);
2631 2635
2632 if (IsEngineInitialized()) 2636 if (IsEngineInitialized())
2633 ReconfigureDatatypeManager(); 2637 ReconfigureDatatypeManager();
2634 NotifyObservers(); 2638 NotifyObservers();
2635 } 2639 }
2636 2640
2637 } // namespace browser_sync 2641 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698