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

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

Issue 652723003: Implementation of OnDiskAttachmentStore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More updates Created 6 years, 2 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 45ccaf9c8efa355eaa53862eaf89463fc86c97eb..520c441deffc67aa8ceb453edb5ffc1ef96aad11 100644
--- a/sync/api/attachments/attachment_store.h
+++ b/sync/api/attachments/attachment_store.h
@@ -13,7 +13,9 @@
#include "sync/base/sync_export.h"
namespace base {
+class FilePath;
class RefCountedMemory;
+class SequencedTaskRunner;
} // namespace base
namespace syncer {
@@ -90,15 +92,42 @@ class SYNC_EXPORT AttachmentStore
: public AttachmentStoreBase,
public base::RefCountedThreadSafe<AttachmentStore> {
public:
+ typedef base::Callback<void(const Result&,
+ const scoped_refptr<AttachmentStore>&)>
+ CreateCallback;
+
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();
+ // Creates an AttachmentStoreHandle backed by on-disk implementation of
+ // attachment store. Opens corresponding leveldb database located at |path|.
+ // All backend operations are scheduled to |backend_task_runner|. Opening
+ // attachment store is asynchronous, once it finishes |callback| will be
+ // called on the thread that called CreateOnDiskStore. |store| parameter of
+ // callback is only valid when |result| is SUCCESS.
+ static void CreateOnDiskStore(
+ const base::FilePath& path,
+ const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner,
+ const CreateCallback& callback);
+
protected:
friend class base::RefCountedThreadSafe<AttachmentStore>;
virtual ~AttachmentStore();
+
+ private:
+ static void CreateOnDiskStoreOnBackendThread(
+ const base::FilePath& path,
+ const scoped_refptr<base::SequencedTaskRunner>& frontend_task_runner,
+ const CreateCallback& callback);
+
+ static void CreateBackendDone(
+ const Result& result,
+ scoped_ptr<AttachmentStoreBase> backend,
+ const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner,
+ const CreateCallback& callback);
};
} // namespace syncer
« 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