From 706d41dd9014de4a25e20069d8b607f291874fc1 Mon Sep 17 00:00:00 2001 From: "maniscalco@chromium.org" Date: Fri, 2 May 2014 19:00:11 +0000 Subject: Keep track of which attachments are referenced by which sync entries. Relanding https://codereview.chromium.org/247983002/ after fixing memory leak. PutAttachmentMetadata on MutableEntry now notifies the Directory when the attachments associated with an entry change. Give Directory::InitializeIndices a ScopedKernelLock to be consistent and make it easier to ensure we are locking when we need to. GenericChangeProcess passes new attachments to AttachmentService for storage and upload. Add an output parameter to GenericChangeProcessor's HandleActionAdd and HandleActionUpdate methods so they can keep track of potentially new attachments and pass them to AttachmentService for storage/upload. Convert AttachmentService's OnSyncDataAdd to StoreAttachments. Implement HasAttachmentNotOnServer. BUG=348625,353303,354530,356266 Review URL: https://codereview.chromium.org/264793007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267887 0039d316-1c4b-4281-b951-d872f2087c98 --- sync/engine/get_commit_ids.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sync/engine') diff --git a/sync/engine/get_commit_ids.cc b/sync/engine/get_commit_ids.cc index 80222ee..5f91915 100644 --- a/sync/engine/get_commit_ids.cc +++ b/sync/engine/get_commit_ids.cc @@ -108,9 +108,13 @@ bool IsEntryInConflict(const syncable::Entry& entry) { // Return true if this entry has any attachments that haven't yet been uploaded // to the server. bool HasAttachmentNotOnServer(const syncable::Entry& entry) { - // TODO(maniscalco): Once AttachmentMetadata is fleshed out, implement this - // function to return true if any of the attachments haven't been uploaded to - // the server. Add test case (bug 356266). + // TODO(maniscalco): Add test case (bug 356266). + const sync_pb::AttachmentMetadata& metadata = entry.GetAttachmentMetadata(); + for (int i = 0; i < metadata.record_size(); ++i) { + if (!metadata.record(i).is_on_server()) { + return true; + } + } return false; } -- cgit v1.1