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

Unified Diff: sync/engine/get_commit_ids.cc

Issue 211523002: Add AttachmentMetadata to Sync's EntryKernel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | sync/protocol/attachments.proto » ('j') | sync/protocol/sync.proto » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/get_commit_ids.cc
diff --git a/sync/engine/get_commit_ids.cc b/sync/engine/get_commit_ids.cc
index 42faf21d4350e70f41259cfb8d1f8ab8a89b8ddd..80222ee20dd625d7efe108195695224d0c5569a6 100644
--- a/sync/engine/get_commit_ids.cc
+++ b/sync/engine/get_commit_ids.cc
@@ -105,6 +105,15 @@ bool IsEntryInConflict(const syncable::Entry& entry) {
return false;
}
+// 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).
+ return false;
+}
+
// An entry is not considered ready for commit if any are true:
// 1. It's in conflict.
// 2. It requires encryption (either the type is encrypted but a passphrase
@@ -161,6 +170,13 @@ bool IsEntryReadyForCommit(ModelTypeSet requested_types,
return false;
}
+ if (HasAttachmentNotOnServer(entry)) {
+ // This entry is not ready to be sent to the server because it has one or
+ // more attachments that have not yet been uploaded to the server. The idea
+ // here is avoid propagating an entry with dangling attachment references.
+ return false;
+ }
+
DVLOG(2) << "Entry is ready for commit: " << entry;
return true;
}
@@ -177,6 +193,11 @@ void FilterUnreadyEntries(
for (syncable::Directory::Metahandles::const_iterator iter =
unsynced_handles.begin(); iter != unsynced_handles.end(); ++iter) {
syncable::Entry entry(trans, syncable::GET_BY_HANDLE, *iter);
+ // TODO(maniscalco): While we check if entry is ready to be committed, we
+ // also need to check that all of its ancestors (parents, transitive) are
+ // ready to be committed. Once attachments can prevent an entry from being
+ // committable, this method must ensure all ancestors are ready for commit
+ // (bug 356273).
if (IsEntryReadyForCommit(requested_types,
encrypted_types,
passphrase_missing,
« no previous file with comments | « no previous file | sync/protocol/attachments.proto » ('j') | sync/protocol/sync.proto » ('J')

Powered by Google App Engine
This is Rietveld 408576698