| Index: sync/syncable/directory.cc
|
| diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc
|
| index cebb2d4fd8401cf0410de0bf543e9c89dc55f148..75c1bec56188b998b3fe9c5e86f4cec4b6138a99 100644
|
| --- a/sync/syncable/directory.cc
|
| +++ b/sync/syncable/directory.cc
|
| @@ -10,7 +10,6 @@
|
| #include "base/debug/trace_event.h"
|
| #include "base/stl_util.h"
|
| #include "base/strings/string_number_conversions.h"
|
| -#include "sync/internal_api/public/base/attachment_id_proto.h"
|
| #include "sync/internal_api/public/base/unique_position.h"
|
| #include "sync/internal_api/public/util/unrecoverable_error_handler.h"
|
| #include "sync/syncable/entry.h"
|
| @@ -124,7 +123,6 @@
|
| }
|
|
|
| void Directory::InitializeIndices(MetahandlesMap* handles_map) {
|
| - ScopedKernelLock lock(this);
|
| kernel_->metahandles_map.swap(*handles_map);
|
| for (MetahandlesMap::const_iterator it = kernel_->metahandles_map.begin();
|
| it != kernel_->metahandles_map.end(); ++it) {
|
| @@ -154,7 +152,6 @@
|
| kernel_->ids_map.end()) << "Unexpected duplicate use of ID";
|
| kernel_->ids_map[entry->ref(ID).value()] = entry;
|
| DCHECK(!entry->is_dirty());
|
| - AddToAttachmentIndex(metahandle, entry->ref(ATTACHMENT_METADATA), lock);
|
| }
|
| }
|
|
|
| @@ -365,8 +362,6 @@
|
| return false;
|
| }
|
| }
|
| - AddToAttachmentIndex(
|
| - entry->ref(META_HANDLE), entry->ref(ATTACHMENT_METADATA), *lock);
|
|
|
| // Should NEVER be created with a client tag or server tag.
|
| if (!SyncAssert(entry->ref(UNIQUE_SERVER_TAG).empty(), FROM_HERE,
|
| @@ -411,51 +406,6 @@
|
| entry->put(PARENT_ID, new_parent_id);
|
| }
|
| return true;
|
| -}
|
| -
|
| -void Directory::RemoveFromAttachmentIndex(
|
| - const int64 metahandle,
|
| - const sync_pb::AttachmentMetadata& attachment_metadata,
|
| - const ScopedKernelLock& lock) {
|
| - for (int i = 0; i < attachment_metadata.record_size(); ++i) {
|
| - AttachmentIdUniqueId unique_id =
|
| - attachment_metadata.record(i).id().unique_id();
|
| - IndexByAttachmentId::iterator iter =
|
| - kernel_->index_by_attachment_id.find(unique_id);
|
| - if (iter != kernel_->index_by_attachment_id.end()) {
|
| - iter->second.erase(metahandle);
|
| - if (iter->second.empty()) {
|
| - kernel_->index_by_attachment_id.erase(iter);
|
| - }
|
| - }
|
| - }
|
| -}
|
| -
|
| -void Directory::AddToAttachmentIndex(
|
| - const int64 metahandle,
|
| - const sync_pb::AttachmentMetadata& attachment_metadata,
|
| - const ScopedKernelLock& lock) {
|
| - for (int i = 0; i < attachment_metadata.record_size(); ++i) {
|
| - AttachmentIdUniqueId unique_id =
|
| - attachment_metadata.record(i).id().unique_id();
|
| - IndexByAttachmentId::iterator iter =
|
| - kernel_->index_by_attachment_id.find(unique_id);
|
| - if (iter == kernel_->index_by_attachment_id.end()) {
|
| - iter = kernel_->index_by_attachment_id.insert(std::make_pair(
|
| - unique_id,
|
| - MetahandleSet())).first;
|
| - }
|
| - iter->second.insert(metahandle);
|
| - }
|
| -}
|
| -
|
| -void Directory::UpdateAttachmentIndex(
|
| - const int64 metahandle,
|
| - const sync_pb::AttachmentMetadata& old_metadata,
|
| - const sync_pb::AttachmentMetadata& new_metadata) {
|
| - ScopedKernelLock lock(this);
|
| - RemoveFromAttachmentIndex(metahandle, old_metadata, lock);
|
| - AddToAttachmentIndex(metahandle, new_metadata, lock);
|
| }
|
|
|
| bool Directory::unrecoverable_error_set(const BaseTransaction* trans) const {
|
| @@ -598,9 +548,6 @@
|
| "Deleted entry still present",
|
| (&trans)))
|
| return false;
|
| - RemoveFromAttachmentIndex(
|
| - entry->ref(META_HANDLE), entry->ref(ATTACHMENT_METADATA), lock);
|
| -
|
| delete entry;
|
| }
|
| if (trans.unrecoverable_error_set())
|
| @@ -660,8 +607,7 @@
|
|
|
| void Directory::DeleteEntry(bool save_to_journal,
|
| EntryKernel* entry,
|
| - EntryKernelSet* entries_to_journal,
|
| - const ScopedKernelLock& lock) {
|
| + EntryKernelSet* entries_to_journal) {
|
| int64 handle = entry->ref(META_HANDLE);
|
| ModelType server_type = GetModelTypeFromSpecifics(
|
| entry->ref(SERVER_SPECIFICS));
|
| @@ -691,7 +637,6 @@
|
| kernel_->server_tags_map.erase(entry->ref(UNIQUE_SERVER_TAG));
|
| DCHECK_EQ(1u, num_erased);
|
| }
|
| - RemoveFromAttachmentIndex(handle, entry->ref(ATTACHMENT_METADATA), lock);
|
|
|
| if (save_to_journal) {
|
| entries_to_journal->insert(entry);
|
| @@ -759,7 +704,7 @@
|
| types_to_journal.Has(server_type)) &&
|
| (delete_journal_->IsDeleteJournalEnabled(local_type) ||
|
| delete_journal_->IsDeleteJournalEnabled(server_type));
|
| - DeleteEntry(save_to_journal, entry, &entries_to_journal, lock);
|
| + DeleteEntry(save_to_journal, entry, &entries_to_journal);
|
| }
|
| }
|
|
|
| @@ -815,17 +760,6 @@
|
| }
|
|
|
| return true;
|
| -}
|
| -
|
| -bool Directory::IsAttachmentLinked(
|
| - const sync_pb::AttachmentIdProto& attachment_id_proto) const {
|
| - ScopedKernelLock lock(this);
|
| - IndexByAttachmentId::const_iterator iter =
|
| - kernel_->index_by_attachment_id.find(attachment_id_proto.unique_id());
|
| - if (iter != kernel_->index_by_attachment_id.end() && !iter->second.empty()) {
|
| - return true;
|
| - }
|
| - return false;
|
| }
|
|
|
| void Directory::HandleSaveChangesFailure(const SaveChangesSnapshot& snapshot) {
|
|
|