summaryrefslogtreecommitdiffstats
path: root/sync/engine
diff options
context:
space:
mode:
authormaniscalco@chromium.org <maniscalco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-02 19:00:11 +0000
committermaniscalco@chromium.org <maniscalco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-02 19:00:11 +0000
commit706d41dd9014de4a25e20069d8b607f291874fc1 (patch)
tree324309d4b9f7194d25a77036d7a2b1fa60eac6f4 /sync/engine
parent92c7f876ef1041d01dc37750420513e19391874c (diff)
downloadchromium_src-706d41dd9014de4a25e20069d8b607f291874fc1.zip
chromium_src-706d41dd9014de4a25e20069d8b607f291874fc1.tar.gz
chromium_src-706d41dd9014de4a25e20069d8b607f291874fc1.tar.bz2
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
Diffstat (limited to 'sync/engine')
-rw-r--r--sync/engine/get_commit_ids.cc10
1 files changed, 7 insertions, 3 deletions
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;
}