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

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

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/api/attachments/attachment.h ('k') | sync/api/attachments/attachment_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/api/attachments/attachment.cc
diff --git a/sync/api/attachments/attachment.cc b/sync/api/attachments/attachment.cc
index 3a4dfc3ed7b6f9806dfd34275bcb33acc5392294..b682520e100022bd0ed4652f5678528bd15c9133 100644
--- a/sync/api/attachments/attachment.cc
+++ b/sync/api/attachments/attachment.cc
@@ -5,6 +5,7 @@
#include "sync/api/attachments/attachment.h"
#include "base/logging.h"
+#include "sync/internal_api/public/attachments/attachment_util.h"
namespace syncer {
@@ -13,14 +14,16 @@ Attachment::~Attachment() {}
// Static.
Attachment Attachment::Create(
const scoped_refptr<base::RefCountedMemory>& data) {
- return CreateWithId(AttachmentId::Create(), data);
+ uint32_t crc32c = ComputeCrc32c(data);
+ return CreateFromParts(AttachmentId::Create(), data, crc32c);
}
// Static.
-Attachment Attachment::CreateWithId(
+Attachment Attachment::CreateFromParts(
const AttachmentId& id,
- const scoped_refptr<base::RefCountedMemory>& data) {
- return Attachment(id, data);
+ const scoped_refptr<base::RefCountedMemory>& data,
+ uint32_t crc32c) {
+ return Attachment(id, data, crc32c);
}
const AttachmentId& Attachment::GetId() const { return id_; }
@@ -29,9 +32,12 @@ const scoped_refptr<base::RefCountedMemory>& Attachment::GetData() const {
return data_;
}
+uint32_t Attachment::GetCrc32c() const { return crc32c_; }
+
Attachment::Attachment(const AttachmentId& id,
- const scoped_refptr<base::RefCountedMemory>& data)
- : id_(id), data_(data) {
+ const scoped_refptr<base::RefCountedMemory>& data,
+ uint32_t crc32c)
+ : id_(id), data_(data), crc32c_(crc32c) {
DCHECK(data.get());
}
« no previous file with comments | « sync/api/attachments/attachment.h ('k') | sync/api/attachments/attachment_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698