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

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 some DCHECKs and another test case. Created 7 years 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') | sync/api/sync_attachment.cc » ('J')
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 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_
OLDNEW
« no previous file with comments | « no previous file | sync/api/sync_attachment.cc » ('j') | sync/api/sync_attachment.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698