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()); |
} |