Revert "Populate EEP estimate in NQE"
[chromium-blink-merge.git] / sync / api / attachments / attachment.cc
blob32a514ac341bcb55cf53bd54fe1d662c34af9459
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "sync/api/attachments/attachment.h"
7 #include "base/logging.h"
8 #include "sync/internal_api/public/attachments/attachment_util.h"
10 namespace syncer {
12 Attachment::~Attachment() {}
14 // Static.
15 Attachment Attachment::Create(
16 const scoped_refptr<base::RefCountedMemory>& data) {
17 uint32_t crc32c = ComputeCrc32c(data);
18 return CreateFromParts(AttachmentId::Create(data->size(), crc32c), data);
21 // Static.
22 Attachment Attachment::CreateFromParts(
23 const AttachmentId& id,
24 const scoped_refptr<base::RefCountedMemory>& data) {
25 return Attachment(id, data);
28 const AttachmentId& Attachment::GetId() const { return id_; }
30 const scoped_refptr<base::RefCountedMemory>& Attachment::GetData() const {
31 return data_;
34 uint32_t Attachment::GetCrc32c() const {
35 return id_.GetCrc32c();
38 Attachment::Attachment(const AttachmentId& id,
39 const scoped_refptr<base::RefCountedMemory>& data)
40 : id_(id), data_(data) {
41 DCHECK_EQ(id.GetSize(), data->size());
42 DCHECK(data.get());
45 } // namespace syncer