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

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: Changes after feedback from Nick 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
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..7955d851ccd8863d48d12f2eca92825431c0f92d 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,
maniscalco 2014/10/17 00:00:19 Can be passed as const&.
pavely 2014/10/17 00:13:25 Done.
+ 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

Powered by Google App Engine
This is Rietveld 408576698