summaryrefslogtreecommitdiffstats
path: root/sync/syncable/directory.cc
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 08:14:14 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 08:14:14 +0000
commitb5e5a42df4b992425cb8692d418dfc1aca1bc316 (patch)
treec1cabba64eff1823e74b343ed361afbdd04c4edd /sync/syncable/directory.cc
parentf5c9dbcb852de1cd6ce1bd293920c8c64a7ad9d9 (diff)
downloadchromium_src-b5e5a42df4b992425cb8692d418dfc1aca1bc316.zip
chromium_src-b5e5a42df4b992425cb8692d418dfc1aca1bc316.tar.gz
chromium_src-b5e5a42df4b992425cb8692d418dfc1aca1bc316.tar.bz2
[Sync] Properly purge context/progress markers for disabled types
We were not properly purging all the context or progress marker info, and it looks like we were even marking the kernel as dirty to ensure it got saved into the directory. This fixes that, and tests it properly. BUG=362307 Review URL: https://codereview.chromium.org/234403003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263193 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/syncable/directory.cc')
-rw-r--r--sync/syncable/directory.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc
index 11bc956..e92f456 100644
--- a/sync/syncable/directory.cc
+++ b/sync/syncable/directory.cc
@@ -39,19 +39,22 @@ Directory::PersistedKernelInfo::PersistedKernelInfo()
ModelTypeSet protocol_types = ProtocolTypes();
for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good();
iter.Inc()) {
- reset_download_progress(iter.Get());
+ ResetDownloadProgress(iter.Get());
transaction_version[iter.Get()] = 0;
}
}
Directory::PersistedKernelInfo::~PersistedKernelInfo() {}
-void Directory::PersistedKernelInfo::reset_download_progress(
+void Directory::PersistedKernelInfo::ResetDownloadProgress(
ModelType model_type) {
+ // Clear everything except the data type id field.
+ download_progress[model_type].Clear();
download_progress[model_type].set_data_type_id(
GetSpecificsFieldNumberFromModelType(model_type));
- // An empty-string token indicates no prior knowledge.
- download_progress[model_type].set_token(std::string());
+
+ // Explicitly set an empty token field to denote no progress.
+ download_progress[model_type].set_token("");
}
Directory::SaveChangesSnapshot::SaveChangesSnapshot()
@@ -716,10 +719,14 @@ bool Directory::PurgeEntriesWithTypeIn(ModelTypeSet disabled_types,
it.Good(); it.Inc()) {
kernel_->persisted_info.transaction_version[it.Get()] = 0;
- // Don't discard progress markers for unapplied types.
- if (!types_to_unapply.Has(it.Get()))
- kernel_->persisted_info.reset_download_progress(it.Get());
+ // Don't discard progress markers or context for unapplied types.
+ if (!types_to_unapply.Has(it.Get())) {
+ kernel_->persisted_info.ResetDownloadProgress(it.Get());
+ kernel_->persisted_info.datatype_context[it.Get()].Clear();
+ }
}
+
+ kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
}
}
return true;