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

Unified Diff: sync/syncable/mutable_entry.cc

Issue 11441026: [Sync] Add support for loading, updating and querying delete journals in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make IsDeleteJournalEnabled() public 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
Index: sync/syncable/mutable_entry.cc
diff --git a/sync/syncable/mutable_entry.cc b/sync/syncable/mutable_entry.cc
index 5090ad1a9116739a00d89ae6f6952ec9c765acaa..caf3a63ea5663c75ed65aa235ca07e213ea6056b 100644
--- a/sync/syncable/mutable_entry.cc
+++ b/sync/syncable/mutable_entry.cc
@@ -273,9 +273,20 @@ bool MutableEntry::Put(ProtoField field,
bool MutableEntry::Put(BitField field, bool value) {
DCHECK(kernel_);
write_transaction_->SaveOriginal(kernel_);
- if (kernel_->ref(field) != value) {
+ bool old_value = kernel_->ref(field);
+ if (old_value != value) {
kernel_->put(field, value);
kernel_->mark_dirty(GetDirtyIndexHelper());
+
+ // Update delete journal for existence status change on server side here
+ // instead of in PutIsDel() because IS_DEL may not be updated due to
+ // early returns when processing updates. And because
+ // UpdateDeleteJournalForServerDelete() checks for SERVER_IS_DEL, it has
+ // to be called on sync thread.
+ if (field == SERVER_IS_DEL) {
+ dir()->delete_journal()->UpdateDeleteJournalForServerDelete(
+ write_transaction(), old_value, *kernel_);
+ }
}
return true;
}

Powered by Google App Engine
This is Rietveld 408576698