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

Unified Diff: components/sync/model_impl/model_type_store_backend.cc

Issue 2953473002: Use leveldb_env::OpenDB() to open leveldb databases. (Closed)
Patch Set: Use OpenDB in unittests; add allocation edges 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
Index: components/sync/model_impl/model_type_store_backend.cc
diff --git a/components/sync/model_impl/model_type_store_backend.cc b/components/sync/model_impl/model_type_store_backend.cc
index a17453122e1be09df40f1d75ed62e4e07d4ae794..f4129b983b599a03d2ffecb50490112cdbd297e9 100644
--- a/components/sync/model_impl/model_type_store_backend.cc
+++ b/components/sync/model_impl/model_type_store_backend.cc
@@ -178,7 +178,6 @@ ModelTypeStore::Result ModelTypeStoreBackend::Init(
leveldb::Status ModelTypeStoreBackend::OpenDatabase(const std::string& path,
leveldb::Env* env) {
- leveldb::DB* db_raw = nullptr;
leveldb::Options options;
options.create_if_missing = true;
options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue;
@@ -186,10 +185,8 @@ leveldb::Status ModelTypeStoreBackend::OpenDatabase(const std::string& path,
if (env)
options.env = env;
- leveldb::Status status = leveldb::DB::Open(options, path, &db_raw);
- DCHECK(status.ok() != (db_raw == nullptr));
- if (status.ok())
- db_.reset(db_raw);
+ leveldb::Status status = leveldb_env::OpenDB(options, path, &db_);
+ DCHECK(status.ok());
pwnall 2017/07/06 14:32:25 I think the intention here was to DCHECK that db_
DmitrySkiba 2017/07/06 23:15:13 Good catch! This also caused tests to fail. Howev
pwnall 2017/07/07 22:30:29 AFAIK, DCHECK can be used to assert that I've unde
DmitrySkiba 2017/07/17 22:09:25 Acknowledged.
return status;
}

Powered by Google App Engine
This is Rietveld 408576698