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