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

Unified Diff: sync/internal_api/model_type_store_impl.cc

Issue 1436573002: [Sync] Implementation of ModelTypeStoreBackend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add paranoid_checks Created 5 years, 1 month 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/internal_api/model_type_store_impl.cc
diff --git a/sync/internal_api/model_type_store_impl.cc b/sync/internal_api/model_type_store_impl.cc
index e7fdcf027b351f234c947861a1d89e72280ba031..f97f621d3e295ecaee77e5db55145d959fe26b43 100644
--- a/sync/internal_api/model_type_store_impl.cc
+++ b/sync/internal_api/model_type_store_impl.cc
@@ -10,6 +10,7 @@
#include "base/task_runner_util.h"
#include "base/thread_task_runner_handle.h"
#include "sync/internal_api/public/model_type_store_backend.h"
+#include "third_party/leveldatabase/src/include/leveldb/env.h"
namespace syncer_v2 {
@@ -44,10 +45,22 @@ void ModelTypeStoreImpl::CreateInMemoryStoreForTest(
base::ThreadTaskRunnerHandle::Get();
scoped_ptr<ModelTypeStoreBackend> backend(new ModelTypeStoreBackend());
+ scoped_ptr<leveldb::Env> env = ModelTypeStoreBackend::CreateInMemoryEnv();
+
+ std::string path;
+ env->GetTestDirectory(&path);
+ path += "/in-memory";
+
+ // Env ownership will be passed to backend, but we still need to keep pointer
+ // for Init call.
+ leveldb::Env* env_ptr = env.get();
+ backend->TakeEnvOwnership(env.Pass());
scoped_ptr<ModelTypeStoreImpl> store(
new ModelTypeStoreImpl(backend.Pass(), task_runner));
- auto task = base::Bind(&ModelTypeStoreBackend::Init,
- base::Unretained(store->backend_.get()));
+
+ auto task =
+ base::Bind(&ModelTypeStoreBackend::Init,
+ base::Unretained(store->backend_.get()), path, env_ptr);
auto reply = base::Bind(&ModelTypeStoreImpl::BackendInitDone, callback,
base::Passed(&store));
« no previous file with comments | « sync/internal_api/model_type_store_backend_unittest.cc ('k') | sync/internal_api/public/model_type_store_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698