OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sync/syncable/mutable_entry.h" | 5 #include "sync/syncable/mutable_entry.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "sync/internal_api/public/base/node_ordinal.h" | 8 #include "sync/internal_api/public/base/node_ordinal.h" |
9 #include "sync/syncable/directory.h" | 9 #include "sync/syncable/directory.h" |
10 #include "sync/syncable/scoped_index_updater.h" | 10 #include "sync/syncable/scoped_index_updater.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 dir()->kernel_->unapplied_update_metahandles[new_server_type] | 266 dir()->kernel_->unapplied_update_metahandles[new_server_type] |
267 .insert(metahandle); | 267 .insert(metahandle); |
268 } | 268 } |
269 } | 269 } |
270 return true; | 270 return true; |
271 } | 271 } |
272 | 272 |
273 bool MutableEntry::Put(BitField field, bool value) { | 273 bool MutableEntry::Put(BitField field, bool value) { |
274 DCHECK(kernel_); | 274 DCHECK(kernel_); |
275 write_transaction_->SaveOriginal(kernel_); | 275 write_transaction_->SaveOriginal(kernel_); |
276 if (kernel_->ref(field) != value) { | 276 bool old_value = kernel_->ref(field); |
277 if (old_value != value) { | |
277 kernel_->put(field, value); | 278 kernel_->put(field, value); |
278 kernel_->mark_dirty(GetDirtyIndexHelper()); | 279 kernel_->mark_dirty(GetDirtyIndexHelper()); |
280 | |
281 if (field == SERVER_IS_DEL) | |
282 dir()->UpdateDeleteJournals(write_transaction(), old_value, *kernel_); | |
tim (not reviewing)
2012/12/13 23:41:30
One thing is that as-written, we could not use Upd
haitaol1
2012/12/14 19:22:38
Comments added.
On 2012/12/13 23:41:30, timsteel
| |
279 } | 283 } |
280 return true; | 284 return true; |
281 } | 285 } |
282 | 286 |
283 MetahandleSet* MutableEntry::GetDirtyIndexHelper() { | 287 MetahandleSet* MutableEntry::GetDirtyIndexHelper() { |
284 return dir()->kernel_->dirty_metahandles; | 288 return dir()->kernel_->dirty_metahandles; |
285 } | 289 } |
286 | 290 |
287 bool MutableEntry::PutUniqueClientTag(const string& new_tag) { | 291 bool MutableEntry::PutUniqueClientTag(const string& new_tag) { |
288 write_transaction_->SaveOriginal(kernel_); | 292 write_transaction_->SaveOriginal(kernel_); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 DCHECK_NE(static_cast<MutableEntry*>(NULL), e); | 430 DCHECK_NE(static_cast<MutableEntry*>(NULL), e); |
427 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; | 431 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; |
428 if (!(e->Put(IS_UNSYNCED, true))) | 432 if (!(e->Put(IS_UNSYNCED, true))) |
429 return false; | 433 return false; |
430 e->Put(SYNCING, false); | 434 e->Put(SYNCING, false); |
431 return true; | 435 return true; |
432 } | 436 } |
433 | 437 |
434 } // namespace syncable | 438 } // namespace syncable |
435 } // namespace syncer | 439 } // namespace syncer |
OLD | NEW |