X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fsync%2Fsyncable%2Fdirectory.cc;h=1af547495e4b968850edd9fb559ccbc63428c1f6;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=be489b26a775ec30444cee967e2c75cc3411c784;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/sync/syncable/directory.cc b/src/sync/syncable/directory.cc index be489b2..1af5474 100644 --- a/src/sync/syncable/directory.cc +++ b/src/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