Index: sync/syncable/directory.cc |
diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc |
index e523bcdf290cec0d608792bb761b257e632d2a9e..39233fee410acda35fcbb382f9473725a0ad6bdd 100644 |
--- a/sync/syncable/directory.cc |
+++ b/sync/syncable/directory.cc |
@@ -463,6 +463,22 @@ void Directory::UpdateAttachmentIndex( |
AddToAttachmentIndex(metahandle, new_metadata, lock); |
} |
+void Directory::GetMetahandlesByAttachmentId( |
+ BaseTransaction* trans, |
+ const sync_pb::AttachmentIdProto& attachment_id_proto, |
+ Metahandles* result) { |
+ DCHECK(result); |
+ result->clear(); |
+ ScopedKernelLock lock(this); |
+ IndexByAttachmentId::const_iterator index_iter = |
+ kernel_->index_by_attachment_id.find(attachment_id_proto.unique_id()); |
+ if (index_iter == kernel_->index_by_attachment_id.end()) |
+ return; |
+ const MetahandleSet& metahandle_set = index_iter->second; |
+ std::copy( |
+ metahandle_set.begin(), metahandle_set.end(), back_inserter(*result)); |
+} |
+ |
bool Directory::unrecoverable_error_set(const BaseTransaction* trans) const { |
DCHECK(trans != NULL); |
return unrecoverable_error_set_; |