OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 return true; | 282 return true; |
283 } | 283 } |
284 | 284 |
285 bool MutableEntry::Put(BitField field, bool value) { | 285 bool MutableEntry::Put(BitField field, bool value) { |
286 DCHECK(kernel_); | 286 DCHECK(kernel_); |
287 write_transaction_->SaveOriginal(kernel_); | 287 write_transaction_->SaveOriginal(kernel_); |
288 bool old_value = kernel_->ref(field); | 288 bool old_value = kernel_->ref(field); |
289 if (old_value != value) { | 289 if (old_value != value) { |
290 kernel_->put(field, value); | 290 kernel_->put(field, value); |
291 kernel_->mark_dirty(GetDirtyIndexHelper()); | 291 kernel_->mark_dirty(GetDirtyIndexHelper()); |
| 292 } |
292 | 293 |
293 // Update delete journal for existence status change on server side here | 294 // Update delete journal for existence status change on server side here |
294 // instead of in PutIsDel() because IS_DEL may not be updated due to | 295 // instead of in PutIsDel() because IS_DEL may not be updated due to |
295 // early returns when processing updates. And because | 296 // early returns when processing updates. And because |
296 // UpdateDeleteJournalForServerDelete() checks for SERVER_IS_DEL, it has | 297 // UpdateDeleteJournalForServerDelete() checks for SERVER_IS_DEL, it has |
297 // to be called on sync thread. | 298 // to be called on sync thread. |
298 if (field == SERVER_IS_DEL) { | 299 if (field == SERVER_IS_DEL) { |
299 dir()->delete_journal()->UpdateDeleteJournalForServerDelete( | 300 dir()->delete_journal()->UpdateDeleteJournalForServerDelete( |
300 write_transaction(), old_value, *kernel_); | 301 write_transaction(), old_value, *kernel_); |
301 } | |
302 } | 302 } |
| 303 |
303 return true; | 304 return true; |
304 } | 305 } |
305 | 306 |
306 MetahandleSet* MutableEntry::GetDirtyIndexHelper() { | 307 MetahandleSet* MutableEntry::GetDirtyIndexHelper() { |
307 return dir()->kernel_->dirty_metahandles; | 308 return dir()->kernel_->dirty_metahandles; |
308 } | 309 } |
309 | 310 |
310 bool MutableEntry::PutUniqueClientTag(const string& new_tag) { | 311 bool MutableEntry::PutUniqueClientTag(const string& new_tag) { |
311 write_transaction_->SaveOriginal(kernel_); | 312 write_transaction_->SaveOriginal(kernel_); |
312 // There is no SERVER_UNIQUE_CLIENT_TAG. This field is similar to ID. | 313 // There is no SERVER_UNIQUE_CLIENT_TAG. This field is similar to ID. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 DCHECK_NE(static_cast<MutableEntry*>(NULL), e); | 450 DCHECK_NE(static_cast<MutableEntry*>(NULL), e); |
450 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; | 451 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; |
451 if (!(e->Put(IS_UNSYNCED, true))) | 452 if (!(e->Put(IS_UNSYNCED, true))) |
452 return false; | 453 return false; |
453 e->Put(SYNCING, false); | 454 e->Put(SYNCING, false); |
454 return true; | 455 return true; |
455 } | 456 } |
456 | 457 |
457 } // namespace syncable | 458 } // namespace syncable |
458 } // namespace syncer | 459 } // namespace syncer |
OLD | NEW |