summaryrefslogtreecommitdiffstats
path: root/sync/syncable
diff options
context:
space:
mode:
Diffstat (limited to 'sync/syncable')
-rw-r--r--sync/syncable/directory_unittest.cc3
-rw-r--r--sync/syncable/mutable_entry.cc9
-rw-r--r--sync/syncable/mutable_entry.h9
3 files changed, 9 insertions, 12 deletions
diff --git a/sync/syncable/directory_unittest.cc b/sync/syncable/directory_unittest.cc
index adc4004..efc97e6 100644
--- a/sync/syncable/directory_unittest.cc
+++ b/sync/syncable/directory_unittest.cc
@@ -1649,8 +1649,7 @@ TEST_F(SyncableDirectoryTest, MutableEntry_UpdateAttachmentId) {
ASSERT_FALSE(entry_metadata.record(1).is_on_server());
ASSERT_FALSE(entry.GetIsUnsynced());
- // TODO(pavely): When we add server info to proto, add test for it here.
- entry.UpdateAttachmentIdWithServerInfo(attachment_id_proto);
+ entry.MarkAttachmentAsOnServer(attachment_id_proto);
ASSERT_TRUE(entry_metadata.record(0).is_on_server());
ASSERT_FALSE(entry_metadata.record(1).is_on_server());
diff --git a/sync/syncable/mutable_entry.cc b/sync/syncable/mutable_entry.cc
index a506e4f..b1c1ff4 100644
--- a/sync/syncable/mutable_entry.cc
+++ b/sync/syncable/mutable_entry.cc
@@ -246,19 +246,18 @@ void MutableEntry::PutAttachmentMetadata(
}
}
-void MutableEntry::UpdateAttachmentIdWithServerInfo(
- const sync_pb::AttachmentIdProto& updated_attachment_id) {
+void MutableEntry::MarkAttachmentAsOnServer(
+ const sync_pb::AttachmentIdProto& attachment_id) {
DCHECK(kernel_);
- DCHECK(!updated_attachment_id.unique_id().empty());
+ DCHECK(!attachment_id.unique_id().empty());
write_transaction()->TrackChangesTo(kernel_);
sync_pb::AttachmentMetadata& attachment_metadata =
kernel_->mutable_ref(ATTACHMENT_METADATA);
for (int i = 0; i < attachment_metadata.record_size(); ++i) {
sync_pb::AttachmentMetadataRecord* record =
attachment_metadata.mutable_record(i);
- if (record->id().unique_id() != updated_attachment_id.unique_id())
+ if (record->id().unique_id() != attachment_id.unique_id())
continue;
- *record->mutable_id() = updated_attachment_id;
record->set_is_on_server(true);
}
kernel_->mark_dirty(&dir()->kernel_->dirty_metahandles);
diff --git a/sync/syncable/mutable_entry.h b/sync/syncable/mutable_entry.h
index 1709475..615fe80 100644
--- a/sync/syncable/mutable_entry.h
+++ b/sync/syncable/mutable_entry.h
@@ -62,11 +62,10 @@ class SYNC_EXPORT_PRIVATE MutableEntry : public ModelNeutralMutableEntry {
void PutAttachmentMetadata(
const sync_pb::AttachmentMetadata& attachment_metadata);
- // Update attachment metadata, replace all records matching attachment id's
- // unique id with updated attachment id that contains server info.
- // Set is_in_server for corresponding records.
- void UpdateAttachmentIdWithServerInfo(
- const sync_pb::AttachmentIdProto& updated_attachment_id);
+ // Update attachment metadata for |attachment_id| to indicate that this
+ // attachment has been uploaded to the sync server.
+ void MarkAttachmentAsOnServer(
+ const sync_pb::AttachmentIdProto& attachment_id);
private:
// Kind of redundant. We should reduce the number of pointers