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

Unified Diff: sync/syncable/directory.cc

Issue 11474036: Remove initial_sync_ended bits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase Created 8 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
« no previous file with comments | « sync/syncable/directory.h ('k') | sync/syncable/directory_backing_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/directory.cc
diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc
index 21e05ebe23e7f06309a43d1c0ce0496422793ad4..82eb709cf52c4988ba032c60e5b9883fab21e5bb 100644
--- a/sync/syncable/directory.cc
+++ b/sync/syncable/directory.cc
@@ -596,7 +596,6 @@ bool Directory::PurgeEntriesWithTypeIn(ModelTypeSet types) {
// Ensure meta tracking for these data types reflects the deleted state.
for (ModelTypeSet::Iterator it = types.First();
it.Good(); it.Inc()) {
- set_initial_sync_ended_for_type_unsafe(it.Get(), false);
kernel_->persisted_info.reset_download_progress(it.Get());
kernel_->persisted_info.transaction_version[it.Get()] = 0;
}
@@ -667,14 +666,30 @@ void Directory::IncrementTransactionVersion(ModelType type) {
kernel_->persisted_info.transaction_version[type]++;
}
-ModelTypeSet Directory::initial_sync_ended_types() const {
- ScopedKernelLock lock(this);
- return kernel_->persisted_info.initial_sync_ended;
+ModelTypeSet Directory::InitialSyncEndedTypes() {
+ syncable::ReadTransaction trans(FROM_HERE, this);
+ const ModelTypeSet all_types = ModelTypeSet::All();
+ ModelTypeSet initial_sync_ended_types;
+ for (ModelTypeSet::Iterator i = all_types.First(); i.Good(); i.Inc()) {
+ if (InitialSyncEndedForType(&trans, i.Get())) {
+ initial_sync_ended_types.Put(i.Get());
+ }
+ }
+ return initial_sync_ended_types;
}
-bool Directory::initial_sync_ended_for_type(ModelType type) const {
- ScopedKernelLock lock(this);
- return kernel_->persisted_info.initial_sync_ended.Has(type);
+bool Directory::InitialSyncEndedForType(ModelType type) {
+ syncable::ReadTransaction trans(FROM_HERE, this);
+ return InitialSyncEndedForType(&trans, type);
+}
+
+bool Directory::InitialSyncEndedForType(
+ BaseTransaction* trans, ModelType type) {
+ // True iff the type's root node has been received and applied.
+ syncable::Entry entry(trans,
+ syncable::GET_BY_SERVER_TAG,
+ ModelTypeToRootTag(type));
+ return entry.good() && entry.Get(syncable::BASE_VERSION) != CHANGES_VERSION;
}
template <class T> void Directory::TestAndSet(
@@ -685,23 +700,6 @@ template <class T> void Directory::TestAndSet(
}
}
-void Directory::set_initial_sync_ended_for_type(ModelType type, bool x) {
- ScopedKernelLock lock(this);
- set_initial_sync_ended_for_type_unsafe(type, x);
-}
-
-void Directory::set_initial_sync_ended_for_type_unsafe(ModelType type,
- bool x) {
- if (kernel_->persisted_info.initial_sync_ended.Has(type) == x)
- return;
- if (x) {
- kernel_->persisted_info.initial_sync_ended.Put(type);
- } else {
- kernel_->persisted_info.initial_sync_ended.Remove(type);
- }
- kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
-}
-
void Directory::SetNotificationStateUnsafe(
const std::string& notification_state) {
if (notification_state == kernel_->persisted_info.notification_state)
« no previous file with comments | « sync/syncable/directory.h ('k') | sync/syncable/directory_backing_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698