OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 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 #ifndef SYNC_API_SYNC_ATTACHMENT_H_ | |
6 #define SYNC_API_SYNC_ATTACHMENT_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "sync/base/sync_export.h" | |
12 #include "sync/protocol/sync.pb.h" | |
13 | |
14 namespace base { | |
15 class RefCountedMemory; | |
16 } // namespace base | |
17 | |
18 namespace syncer { | |
19 | |
20 // An immutable blob of in-memory data attached to a sync item. | |
21 class SYNC_EXPORT SyncAttachment { | |
22 public: | |
23 ~SyncAttachment(); | |
24 | |
25 // Creates an attachment with a unique id and the supplied bytes. | |
26 static scoped_ptr<SyncAttachment> Create( | |
27 const scoped_refptr<base::RefCountedMemory>& bytes); | |
28 | |
29 // Creates an attachment with the supplied id and bytes. | |
Nicolas Zea
2013/12/30 19:10:31
Maybe comment some more about why someone would su
maniscalco
2013/12/30 22:17:19
Expanded the comments to clarify. Done.
| |
30 static scoped_ptr<SyncAttachment> CreateWithId( | |
31 const sync_pb::SyncAttachmentId& id, | |
32 const scoped_refptr<base::RefCountedMemory>& bytes); | |
33 | |
34 // Returns this attachment's id. | |
35 const sync_pb::SyncAttachmentId& GetId() const; | |
36 | |
37 // Returns this attachments bytes. | |
Nicolas Zea
2013/12/30 19:10:31
nit: attachments -> attachment's
maniscalco
2013/12/30 22:17:19
Done.
| |
38 const scoped_refptr<base::RefCountedMemory>& GetBytes() const; | |
39 | |
40 private: | |
41 SyncAttachment(const sync_pb::SyncAttachmentId& id, | |
Nicolas Zea
2013/12/30 19:10:31
nit: move this below the member variables below
maniscalco
2013/12/30 22:17:19
Done.
| |
42 const scoped_refptr<base::RefCountedMemory>& bytes); | |
43 | |
44 private: | |
45 const sync_pb::SyncAttachmentId id_; | |
46 const scoped_refptr<base::RefCountedMemory> bytes_; | |
47 | |
48 // Default copy ctor welcome. | |
49 DISALLOW_ASSIGN(SyncAttachment); | |
50 }; | |
51 | |
52 } // namespace syncer | |
53 | |
54 #endif // SYNC_API_SYNC_ATTACHMENT_H_ | |
OLD | NEW |