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

Unified Diff: sync/api/attachments/attachment_store.h

Issue 601553004: Refactor FakeAttachmentStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Newline Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/BUILD.gn ('k') | sync/api/attachments/attachment_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/api/attachments/attachment_store.h
diff --git a/sync/api/attachments/attachment_store.h b/sync/api/attachments/attachment_store.h
index d487f8cd1775673a6cc3cee53b788e9f730f6c35..45ccaf9c8efa355eaa53862eaf89463fc86c97eb 100644
--- a/sync/api/attachments/attachment_store.h
+++ b/sync/api/attachments/attachment_store.h
@@ -25,10 +25,8 @@ class AttachmentId;
//
// Destroying this object does not necessarily cancel outstanding async
// operations. If you need cancel like semantics, use WeakPtr in the callbacks.
-class SYNC_EXPORT AttachmentStore : public base::RefCounted<AttachmentStore> {
+class SYNC_EXPORT AttachmentStoreBase {
public:
- AttachmentStore();
-
// TODO(maniscalco): Consider udpating Read and Write methods to support
// resumable transfers (bug 353292).
@@ -43,6 +41,9 @@ class SYNC_EXPORT AttachmentStore : public base::RefCounted<AttachmentStore> {
typedef base::Callback<void(const Result&)> WriteCallback;
typedef base::Callback<void(const Result&)> DropCallback;
+ AttachmentStoreBase();
+ virtual ~AttachmentStoreBase();
+
// Asynchronously reads the attachments identified by |ids|.
//
// |callback| will be invoked when finished. AttachmentStore will attempt to
@@ -81,9 +82,22 @@ class SYNC_EXPORT AttachmentStore : public base::RefCounted<AttachmentStore> {
// successfully.
virtual void Drop(const AttachmentIdList& ids,
const DropCallback& callback) = 0;
+};
+
+// AttachmentStore is an interface exposed to data type and AttachmentService
+// code. Also contains factory methods for default implementations.
+class SYNC_EXPORT AttachmentStore
+ : public AttachmentStoreBase,
+ public base::RefCountedThreadSafe<AttachmentStore> {
+ public:
+ AttachmentStore();
+
+ // Creates an AttachmentStoreHandle backed by in-memory implementation of
+ // attachment store. For now frontend lives on the same thread as backend.
+ static scoped_refptr<AttachmentStore> CreateInMemoryStore();
protected:
- friend class base::RefCounted<AttachmentStore>;
+ friend class base::RefCountedThreadSafe<AttachmentStore>;
virtual ~AttachmentStore();
};
« no previous file with comments | « sync/BUILD.gn ('k') | sync/api/attachments/attachment_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698