Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Unified Diff: sync/syncable/mutable_entry.cc

Issue 272043002: Invoke AttachmentUploader and update AttachmentIds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« sync/syncable/mutable_entry.h ('K') | « sync/syncable/mutable_entry.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/mutable_entry.cc
diff --git a/sync/syncable/mutable_entry.cc b/sync/syncable/mutable_entry.cc
index d9d5daa890f0c13fedd1723bfe9b27794a4b2d14..337b56b9fcdfd45d6efaf9f048fa75cf692807f6 100644
--- a/sync/syncable/mutable_entry.cc
+++ b/sync/syncable/mutable_entry.cc
@@ -247,6 +247,24 @@ void MutableEntry::PutAttachmentMetadata(
}
}
+void MutableEntry::UpdateAttachmentId(
maniscalco 2014/05/09 18:12:11 How about adding a unit test for this method? dir
pavely 2014/05/13 23:06:44 Done.
+ const sync_pb::AttachmentIdProto& attachment_id) {
+ DCHECK(kernel_);
maniscalco 2014/05/09 18:12:11 Consider DCHECKing that attachment_id's unique_id
pavely 2014/05/13 23:06:44 Done.
+ 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() != attachment_id.unique_id())
+ continue;
+ record->set_is_on_server(true);
maniscalco 2014/05/09 18:12:11 I wonder if we can make it more obvious that this
pavely 2014/05/13 23:06:44 Decided to name it UpdateAttachmentIdWithServerInf
+ record->mutable_id()->set_url(attachment_id.url());
+ }
+ kernel_->mark_dirty(&dir()->kernel_->dirty_metahandles);
+ MarkForSyncing(this);
+}
+
// This function sets only the flags needed to get this entry to sync.
bool MarkForSyncing(MutableEntry* e) {
DCHECK_NE(static_cast<MutableEntry*>(NULL), e);
« sync/syncable/mutable_entry.h ('K') | « sync/syncable/mutable_entry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698