| 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/directory.h" | 5 #include "sync/syncable/directory.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/perftimer.h" | 8 #include "base/perftimer.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 num_erased = kernel_->parent_id_child_index->erase(entry); | 616 num_erased = kernel_->parent_id_child_index->erase(entry); |
| 617 DCHECK_EQ(entry->ref(IS_DEL), !num_erased); | 617 DCHECK_EQ(entry->ref(IS_DEL), !num_erased); |
| 618 kernel_->metahandles_index->erase(it++); | 618 kernel_->metahandles_index->erase(it++); |
| 619 delete entry; | 619 delete entry; |
| 620 } else { | 620 } else { |
| 621 ++it; | 621 ++it; |
| 622 } | 622 } |
| 623 } | 623 } |
| 624 | 624 |
| 625 // Ensure meta tracking for these data types reflects the deleted state. | 625 // Ensure meta tracking for these data types reflects the deleted state. |
| 626 for (syncable::ModelTypeSet::Iterator it = types.First(); | 626 for (syncer::ModelTypeSet::Iterator it = types.First(); |
| 627 it.Good(); it.Inc()) { | 627 it.Good(); it.Inc()) { |
| 628 set_initial_sync_ended_for_type_unsafe(it.Get(), false); | 628 set_initial_sync_ended_for_type_unsafe(it.Get(), false); |
| 629 kernel_->persisted_info.reset_download_progress(it.Get()); | 629 kernel_->persisted_info.reset_download_progress(it.Get()); |
| 630 } | 630 } |
| 631 } | 631 } |
| 632 } | 632 } |
| 633 } | 633 } |
| 634 | 634 |
| 635 void Directory::HandleSaveChangesFailure(const SaveChangesSnapshot& snapshot) { | 635 void Directory::HandleSaveChangesFailure(const SaveChangesSnapshot& snapshot) { |
| 636 ScopedKernelLock lock(this); | 636 ScopedKernelLock lock(this); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 kernel_->unsynced_metahandles->end(), back_inserter(*result)); | 791 kernel_->unsynced_metahandles->end(), back_inserter(*result)); |
| 792 } | 792 } |
| 793 | 793 |
| 794 int64 Directory::unsynced_entity_count() const { | 794 int64 Directory::unsynced_entity_count() const { |
| 795 ScopedKernelLock lock(this); | 795 ScopedKernelLock lock(this); |
| 796 return kernel_->unsynced_metahandles->size(); | 796 return kernel_->unsynced_metahandles->size(); |
| 797 } | 797 } |
| 798 | 798 |
| 799 FullModelTypeSet Directory::GetServerTypesWithUnappliedUpdates( | 799 FullModelTypeSet Directory::GetServerTypesWithUnappliedUpdates( |
| 800 BaseTransaction* trans) const { | 800 BaseTransaction* trans) const { |
| 801 syncable::FullModelTypeSet server_types; | 801 syncer::FullModelTypeSet server_types; |
| 802 ScopedKernelLock lock(this); | 802 ScopedKernelLock lock(this); |
| 803 for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { | 803 for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { |
| 804 const ModelType type = ModelTypeFromInt(i); | 804 const ModelType type = ModelTypeFromInt(i); |
| 805 if (!kernel_->unapplied_update_metahandles[type].empty()) { | 805 if (!kernel_->unapplied_update_metahandles[type].empty()) { |
| 806 server_types.Put(type); | 806 server_types.Put(type); |
| 807 } | 807 } |
| 808 } | 808 } |
| 809 return server_types; | 809 return server_types; |
| 810 } | 810 } |
| 811 | 811 |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 // There were no children in the linked list. | 1239 // There were no children in the linked list. |
| 1240 return NULL; | 1240 return NULL; |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 ScopedKernelLock::ScopedKernelLock(const Directory* dir) | 1243 ScopedKernelLock::ScopedKernelLock(const Directory* dir) |
| 1244 : scoped_lock_(dir->kernel_->mutex), dir_(const_cast<Directory*>(dir)) { | 1244 : scoped_lock_(dir->kernel_->mutex), dir_(const_cast<Directory*>(dir)) { |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 } // namespace syncable | 1247 } // namespace syncable |
| 1248 } // namespace syncer | 1248 } // namespace syncer |
| OLD | NEW |