Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: sync/api/sync_attachment.h

Issue 102193004: Checkpointing some Sync Attachment work. Added SyncAttachment and SyncAttachmentId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing SYNC_EXPORT_PRIVATE modifier (was cause of link error on trybots). Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sync/api/sync_attachment.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 //
27 // Used when creating a brand new attachment.
28 static scoped_ptr<SyncAttachment> Create(
29 const scoped_refptr<base::RefCountedMemory>& bytes);
30
31 // Creates an attachment with the supplied id and bytes.
32 //
33 // Used when you want to recreate a specific attachment. E.g. creating a local
34 // copy of an attachment that already exists on the sync server.
35 static scoped_ptr<SyncAttachment> CreateWithId(
36 const sync_pb::SyncAttachmentId& id,
37 const scoped_refptr<base::RefCountedMemory>& bytes);
38
39 // Returns this attachment's id.
40 const sync_pb::SyncAttachmentId& GetId() const;
41
42 // Returns this attachment's bytes.
43 const scoped_refptr<base::RefCountedMemory>& GetBytes() const;
44
45 private:
46 const sync_pb::SyncAttachmentId id_;
47 const scoped_refptr<base::RefCountedMemory> bytes_;
48
49 SyncAttachment(const sync_pb::SyncAttachmentId& id,
50 const scoped_refptr<base::RefCountedMemory>& bytes);
51
52 // Default copy ctor welcome.
53 DISALLOW_ASSIGN(SyncAttachment);
54 };
55
56 } // namespace syncer
57
58 #endif // SYNC_API_SYNC_ATTACHMENT_H_
OLDNEW
« no previous file with comments | « no previous file | sync/api/sync_attachment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698