| Index: sync/api/attachments/attachment.cc
|
| diff --git a/sync/api/attachments/attachment.cc b/sync/api/attachments/attachment.cc
|
| index 3a4dfc3ed7b6f9806dfd34275bcb33acc5392294..8a6b8391d2a41e94b2353ea4fc4bffd3e5f61833 100644
|
| --- a/sync/api/attachments/attachment.cc
|
| +++ b/sync/api/attachments/attachment.cc
|
| @@ -5,22 +5,25 @@
|
| #include "sync/api/attachments/attachment.h"
|
|
|
| #include "base/logging.h"
|
| +#include "sync/internal_api/public/attachments/attachment_util.h"
|
|
|
| namespace syncer {
|
|
|
| Attachment::~Attachment() {}
|
|
|
| // Static.
|
| -Attachment Attachment::Create(
|
| +Attachment Attachment::CreateNew(
|
| const scoped_refptr<base::RefCountedMemory>& data) {
|
| - return CreateWithId(AttachmentId::Create(), data);
|
| + uint32_t crc = ComputeCrc32c(data);
|
| + return RestoreExisting(AttachmentId::Create(), data, crc);
|
| }
|
|
|
| // Static.
|
| -Attachment Attachment::CreateWithId(
|
| +Attachment Attachment::RestoreExisting(
|
| 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());
|
| }
|
|
|
|
|