• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #include "sync/api/attachments/attachment.h"
6 
7 #include "base/logging.h"
8 
9 namespace syncer {
10 
~Attachment()11 Attachment::~Attachment() {}
12 
13 // Static.
Create(const scoped_refptr<base::RefCountedMemory> & data)14 Attachment Attachment::Create(
15     const scoped_refptr<base::RefCountedMemory>& data) {
16   return CreateWithId(AttachmentId::Create(), data);
17 }
18 
19 // Static.
CreateWithId(const AttachmentId & id,const scoped_refptr<base::RefCountedMemory> & data)20 Attachment Attachment::CreateWithId(
21     const AttachmentId& id,
22     const scoped_refptr<base::RefCountedMemory>& data) {
23   return Attachment(id, data);
24 }
25 
GetId() const26 const AttachmentId& Attachment::GetId() const { return id_; }
27 
GetData() const28 const scoped_refptr<base::RefCountedMemory>& Attachment::GetData() const {
29   return data_;
30 }
31 
Attachment(const AttachmentId & id,const scoped_refptr<base::RefCountedMemory> & data)32 Attachment::Attachment(const AttachmentId& id,
33                        const scoped_refptr<base::RefCountedMemory>& data)
34     : id_(id), data_(data) {
35   DCHECK(data.get());
36 }
37 
38 }  // namespace syncer
39