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

Unified Diff: components/leveldb/leveldb_service_impl.cc

Issue 2953473002: Use leveldb_env::OpenDB() to open leveldb databases. (Closed)
Patch Set: Rebase; add comments to CHECK() Created 3 years, 5 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 | « components/leveldb/leveldb_database_impl.cc ('k') | components/leveldb_proto/leveldb_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/leveldb/leveldb_service_impl.cc
diff --git a/components/leveldb/leveldb_service_impl.cc b/components/leveldb/leveldb_service_impl.cc
index a26f0ba8726210bc9f2749e7ce2d03ea9b23fdd9..a64061664039733f944209127083ee7363ad4e40 100644
--- a/components/leveldb/leveldb_service_impl.cc
+++ b/components/leveldb/leveldb_service_impl.cc
@@ -68,15 +68,14 @@ void LevelDBServiceImpl::OpenWithOptions(
leveldb::NewLRUCache(open_options->block_cache_size));
options.block_cache = cache.get();
- leveldb::DB* db = nullptr;
- leveldb::Status s = leveldb::DB::Open(options, dbname, &db);
+ std::unique_ptr<leveldb::DB> db;
+ leveldb::Status s = leveldb_env::OpenDB(options, dbname, &db);
if (s.ok()) {
- mojo::MakeStrongAssociatedBinding(
- base::MakeUnique<LevelDBDatabaseImpl>(std::move(env_mojo),
- base::WrapUnique(db),
- std::move(cache), memory_dump_id),
- std::move(database));
+ mojo::MakeStrongAssociatedBinding(base::MakeUnique<LevelDBDatabaseImpl>(
+ std::move(env_mojo), std::move(db),
+ std::move(cache), memory_dump_id),
+ std::move(database));
}
std::move(callback).Run(LeveldbStatusToError(s));
@@ -95,13 +94,13 @@ void LevelDBServiceImpl::OpenInMemory(
leveldb::NewMemEnv(leveldb::Env::Default()));
options.env = env.get();
- leveldb::DB* db = nullptr;
- leveldb::Status s = leveldb::DB::Open(options, "", &db);
+ std::unique_ptr<leveldb::DB> db;
+ leveldb::Status s = leveldb_env::OpenDB(options, "", &db);
if (s.ok()) {
mojo::MakeStrongAssociatedBinding(
- base::MakeUnique<LevelDBDatabaseImpl>(
- std::move(env), base::WrapUnique(db), nullptr, memory_dump_id),
+ base::MakeUnique<LevelDBDatabaseImpl>(std::move(env), std::move(db),
+ nullptr, memory_dump_id),
std::move(database));
}
« no previous file with comments | « components/leveldb/leveldb_database_impl.cc ('k') | components/leveldb_proto/leveldb_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698