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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sync/api/sync_attachment.cc » ('j') | sync/api/sync_attachment.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/api/sync_attachment.h
diff --git a/sync/api/sync_attachment.h b/sync/api/sync_attachment.h
new file mode 100644
index 0000000000000000000000000000000000000000..f3ecef53d15af058e88e73ff84e03f0119fb28d0
--- /dev/null
+++ b/sync/api/sync_attachment.h
@@ -0,0 +1,54 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_API_SYNC_ATTACHMENT_H_
+#define SYNC_API_SYNC_ATTACHMENT_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "sync/base/sync_export.h"
+#include "sync/protocol/sync.pb.h"
+
+namespace base {
+class RefCountedMemory;
+} // namespace base
+
+namespace syncer {
+
+// An immutable blob of in-memory data attached to a sync item.
+class SYNC_EXPORT SyncAttachment {
+ public:
+ ~SyncAttachment();
+
+ // Creates an attachment with a unique id and the supplied bytes.
+ static scoped_ptr<SyncAttachment> Create(
+ const scoped_refptr<base::RefCountedMemory>& bytes);
+
+ // 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.
+ static scoped_ptr<SyncAttachment> CreateWithId(
+ const sync_pb::SyncAttachmentId& id,
+ const scoped_refptr<base::RefCountedMemory>& bytes);
+
+ // Returns this attachment's id.
+ const sync_pb::SyncAttachmentId& GetId() const;
+
+ // Returns this attachments bytes.
Nicolas Zea 2013/12/30 19:10:31 nit: attachments -> attachment's
maniscalco 2013/12/30 22:17:19 Done.
+ const scoped_refptr<base::RefCountedMemory>& GetBytes() const;
+
+ private:
+ 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.
+ const scoped_refptr<base::RefCountedMemory>& bytes);
+
+ private:
+ const sync_pb::SyncAttachmentId id_;
+ const scoped_refptr<base::RefCountedMemory> bytes_;
+
+ // Default copy ctor welcome.
+ DISALLOW_ASSIGN(SyncAttachment);
+};
+
+} // namespace syncer
+
+#endif // SYNC_API_SYNC_ATTACHMENT_H_
« 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