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

Unified Diff: sync/api/attachments/attachment.h

Issue 710073003: Store attachment crc in AttachmentStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Add comment in attachment_util.h. Created 6 years, 1 month 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 | « sync/BUILD.gn ('k') | sync/api/attachments/attachment.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/api/attachments/attachment.h
diff --git a/sync/api/attachments/attachment.h b/sync/api/attachments/attachment.h
index af4c36da70b0f71eb8393c03fc0fa89074d7265d..51fe9863baa733401001b673c128fe89fe1f770c 100644
--- a/sync/api/attachments/attachment.h
+++ b/sync/api/attachments/attachment.h
@@ -34,13 +34,14 @@ class SYNC_EXPORT Attachment {
// Used when creating a brand new attachment.
static Attachment Create(const scoped_refptr<base::RefCountedMemory>& data);
- // Creates an attachment with the supplied id and data.
+ // Creates an attachment with the supplied id, data and crc32c.
//
// Used when you want to recreate a specific attachment. E.g. creating a local
// copy of an attachment that already exists on the sync server.
- static Attachment CreateWithId(
+ static Attachment CreateFromParts(
const AttachmentId& id,
- const scoped_refptr<base::RefCountedMemory>& data);
+ const scoped_refptr<base::RefCountedMemory>& data,
+ uint32_t crc32c);
// Returns this attachment's id.
const AttachmentId& GetId() const;
@@ -48,12 +49,20 @@ class SYNC_EXPORT Attachment {
// Returns this attachment's data.
const scoped_refptr<base::RefCountedMemory>& GetData() const;
+ // Returns precomputed crc32c hash of data. In ideal case this hash is
+ // computed when attachment is first created. It is then passed around through
+ // local attachment store and attachment server. Crc is verified when
+ // attachment is downloaded from server or loaded from local storage.
+ uint32_t GetCrc32c() const;
+
private:
AttachmentId id_;
scoped_refptr<base::RefCountedMemory> data_;
+ uint32_t crc32c_;
Attachment(const AttachmentId& id,
- const scoped_refptr<base::RefCountedMemory>& data);
+ const scoped_refptr<base::RefCountedMemory>& data,
+ uint32_t crc32c);
};
typedef std::vector<syncer::Attachment> AttachmentList;
« no previous file with comments | « sync/BUILD.gn ('k') | sync/api/attachments/attachment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698