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

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

Issue 982883002: [Sync] Add size and crc32c to AttachmentId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with master. Created 5 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 | « sync/api/attachments/attachment.h ('k') | sync/api/attachments/attachment_id.h » ('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 b682520e100022bd0ed4652f5678528bd15c9133..32a514ac341bcb55cf53bd54fe1d662c34af9459 100644
--- a/sync/api/attachments/attachment.cc
+++ b/sync/api/attachments/attachment.cc
@@ -15,15 +15,14 @@ Attachment::~Attachment() {}
Attachment Attachment::Create(
const scoped_refptr<base::RefCountedMemory>& data) {
uint32_t crc32c = ComputeCrc32c(data);
- return CreateFromParts(AttachmentId::Create(), data, crc32c);
+ return CreateFromParts(AttachmentId::Create(data->size(), crc32c), data);
}
// Static.
Attachment Attachment::CreateFromParts(
const AttachmentId& id,
- const scoped_refptr<base::RefCountedMemory>& data,
- uint32_t crc32c) {
- return Attachment(id, data, crc32c);
+ const scoped_refptr<base::RefCountedMemory>& data) {
+ return Attachment(id, data);
}
const AttachmentId& Attachment::GetId() const { return id_; }
@@ -32,12 +31,14 @@ const scoped_refptr<base::RefCountedMemory>& Attachment::GetData() const {
return data_;
}
-uint32_t Attachment::GetCrc32c() const { return crc32c_; }
+uint32_t Attachment::GetCrc32c() const {
+ return id_.GetCrc32c();
+}
Attachment::Attachment(const AttachmentId& id,
- const scoped_refptr<base::RefCountedMemory>& data,
- uint32_t crc32c)
- : id_(id), data_(data), crc32c_(crc32c) {
+ const scoped_refptr<base::RefCountedMemory>& data)
+ : id_(id), data_(data) {
+ DCHECK_EQ(id.GetSize(), data->size());
DCHECK(data.get());
}
« no previous file with comments | « sync/api/attachments/attachment.h ('k') | sync/api/attachments/attachment_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698