diff options
author | maniscalco@chromium.org <maniscalco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-02 03:40:29 +0000 |
---|---|---|
committer | maniscalco@chromium.org <maniscalco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-02 03:40:29 +0000 |
commit | 96c08a8850dfd2039696b553a974b1faddbf2636 (patch) | |
tree | 5f4dd3fd1eebe6a2a59f73a3b393aadfd06b2037 /sync/engine | |
parent | 26d8482f9f2554a9926c7e5da18fa623ae3ad62f (diff) | |
download | chromium_src-96c08a8850dfd2039696b553a974b1faddbf2636.zip chromium_src-96c08a8850dfd2039696b553a974b1faddbf2636.tar.gz chromium_src-96c08a8850dfd2039696b553a974b1faddbf2636.tar.bz2 |
Add AttachmentMetadata to Sync's EntryKernel.
In future CLs, AttachmentMetadata will be extended to include metadata
about the sync entries attachments such as attachment ids and whether
they have been upload to the server.
BUG=348625
Review URL: https://codereview.chromium.org/211523002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261046 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine')
-rw-r--r-- | sync/engine/get_commit_ids.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sync/engine/get_commit_ids.cc b/sync/engine/get_commit_ids.cc index 42faf21..80222ee 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, |