Index: sync/syncable/directory.cc |
diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc |
index be489b26a775ec30444cee967e2c75cc3411c784..1af547495e4b968850edd9fb559ccbc63428c1f6 100644 |
--- a/sync/syncable/directory.cc |
+++ b/sync/syncable/directory.cc |
@@ -58,6 +58,13 @@ void Directory::PersistedKernelInfo::ResetDownloadProgress( |
download_progress[model_type].set_token(""); |
} |
+bool Directory::PersistedKernelInfo::HasEmptyDownloadProgress( |
+ ModelType model_type) { |
+ const sync_pb::DataTypeProgressMarker& progress_marker = |
+ download_progress[model_type]; |
+ return progress_marker.token().empty(); |
+} |
+ |
Directory::SaveChangesSnapshot::SaveChangesSnapshot() |
: kernel_info_status(KERNEL_SHARE_INFO_INVALID) { |
} |
@@ -738,6 +745,18 @@ bool Directory::PurgeEntriesWithTypeIn(ModelTypeSet disabled_types, |
{ |
ScopedKernelLock lock(this); |
+ bool found_progress = false; |
+ for (ModelTypeSet::Iterator iter = disabled_types.First(); iter.Good(); |
+ iter.Inc()) { |
+ if (!kernel_->persisted_info.HasEmptyDownloadProgress(iter.Get())) |
+ found_progress = true; |
+ } |
+ |
+ // If none of the disabled types have progress markers, there's nothing to |
+ // purge. |
+ if (!found_progress) |
+ return true; |
+ |
// We iterate in two passes to avoid a bug in STLport (which is used in |
// the Android build). There are some versions of that library where a |
// hash_map's iterators can be invalidated when an item is erased from the |