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

Unified Diff: components/sync/engine_impl/sync_manager_impl.cc

Issue 2563883006: [Sync] Separate purge types step from sync manager configuration. (Closed)
Patch Set: Created 4 years 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
Index: components/sync/engine_impl/sync_manager_impl.cc
diff --git a/components/sync/engine_impl/sync_manager_impl.cc b/components/sync/engine_impl/sync_manager_impl.cc
index a41eb56c52c8aca3b7b0b6fd361542b1d83c51ff..87dd222786c1186e8ecd65d997c3fad961a6ca64 100644
--- a/components/sync/engine_impl/sync_manager_impl.cc
+++ b/components/sync/engine_impl/sync_manager_impl.cc
@@ -184,9 +184,6 @@ ModelTypeSet SyncManagerImpl::GetTypesWithEmptyProgressMarkerToken(
void SyncManagerImpl::ConfigureSyncer(
ConfigureReason reason,
ModelTypeSet to_download,
- ModelTypeSet to_purge,
- ModelTypeSet to_journal,
- ModelTypeSet to_unapply,
const ModelSafeRoutingInfo& new_routing_info,
const base::Closure& ready_task,
const base::Closure& retry_task) {
@@ -203,19 +200,7 @@ void SyncManagerImpl::ConfigureSyncer(
<< "current types: "
<< ModelTypeSetToString(GetRoutingInfoTypes(new_routing_info))
<< "\n\t"
- << "types to download: " << ModelTypeSetToString(to_download)
- << "\n\t"
- << "types to purge: " << ModelTypeSetToString(to_purge) << "\n\t"
- << "types to journal: " << ModelTypeSetToString(to_journal) << "\n\t"
- << "types to unapply: " << ModelTypeSetToString(to_unapply);
- if (!PurgeDisabledTypes(to_purge, to_journal, to_unapply)) {
- // We failed to cleanup the types. Invoke the ready task without actually
- // configuring any types. The caller should detect this as a configuration
- // failure and act appropriately.
- ready_task.Run();
- return;
- }
-
+ << "types to download: " << ModelTypeSetToString(to_download);
ConfigurationParams params(GetSourceFromReason(reason), to_download,
new_routing_info, ready_task, retry_task);
@@ -460,13 +445,11 @@ bool SyncManagerImpl::OpenDirectory(const std::string& username) {
// trigger the migration logic before the backend is initialized, resulting
// in crashes. We therefore detect and purge any partially synced types as
// part of initialization.
- if (!PurgePartiallySyncedTypes())
- return false;
-
+ PurgePartiallySyncedTypes();
return true;
}
-bool SyncManagerImpl::PurgePartiallySyncedTypes() {
+void SyncManagerImpl::PurgePartiallySyncedTypes() {
ModelTypeSet partially_synced_types = ModelTypeSet::All();
partially_synced_types.RemoveAll(directory()->InitialSyncEndedTypes());
partially_synced_types.RemoveAll(
@@ -476,21 +459,22 @@ bool SyncManagerImpl::PurgePartiallySyncedTypes() {
<< ModelTypeSetToString(partially_synced_types);
UMA_HISTOGRAM_COUNTS("Sync.PartiallySyncedTypes",
partially_synced_types.Size());
- if (partially_synced_types.Empty())
- return true;
- return directory()->PurgeEntriesWithTypeIn(partially_synced_types,
- ModelTypeSet(), ModelTypeSet());
+ directory()->PurgeEntriesWithTypeIn(partially_synced_types, ModelTypeSet(),
+ ModelTypeSet());
}
-bool SyncManagerImpl::PurgeDisabledTypes(ModelTypeSet to_purge,
+void SyncManagerImpl::PurgeDisabledTypes(ModelTypeSet to_purge,
ModelTypeSet to_journal,
ModelTypeSet to_unapply) {
- if (to_purge.Empty())
- return true;
- DVLOG(1) << "Purging disabled types " << ModelTypeSetToString(to_purge);
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(initialized_);
+ DVLOG(1) << "Purging disabled types:\n\t"
+ << "types to purge: " << ModelTypeSetToString(to_purge) << "\n\t"
+ << "types to journal: " << ModelTypeSetToString(to_journal) << "\n\t"
+ << "types to unapply: " << ModelTypeSetToString(to_unapply);
DCHECK(to_purge.HasAll(to_journal));
DCHECK(to_purge.HasAll(to_unapply));
- return directory()->PurgeEntriesWithTypeIn(to_purge, to_journal, to_unapply);
+ directory()->PurgeEntriesWithTypeIn(to_purge, to_journal, to_unapply);
}
void SyncManagerImpl::UpdateCredentials(const SyncCredentials& credentials) {
« no previous file with comments | « components/sync/engine_impl/sync_manager_impl.h ('k') | components/sync/engine_impl/sync_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698