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

Unified Diff: google_apis/gcm/engine/gcm_store_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
Index: google_apis/gcm/engine/gcm_store_impl.cc
diff --git a/google_apis/gcm/engine/gcm_store_impl.cc b/google_apis/gcm/engine/gcm_store_impl.cc
index 59600a1152460bcf99a344a9f174c7568e60143c..cb5e9d69d58d543db5079355fff1f7e2632e0819 100644
--- a/google_apis/gcm/engine/gcm_store_impl.cc
+++ b/google_apis/gcm/engine/gcm_store_impl.cc
@@ -292,7 +292,7 @@ LoadStatus GCMStoreImpl::Backend::OpenStoreAndLoadData(StoreOpenMode open_mode,
return RELOADING_OPEN_STORE;
}
- // Checks if the store exists or not. Calling DB::Open with create_if_missing
+ // Checks if the store exists or not. Opening a db with create_if_missing
// not set will still create a new directory if the store does not exist.
if (open_mode == DO_NOT_CREATE && !DatabaseExists(path_)) {
DVLOG(2) << "Database " << path_.value() << " does not exist";
@@ -303,9 +303,8 @@ LoadStatus GCMStoreImpl::Backend::OpenStoreAndLoadData(StoreOpenMode open_mode,
options.create_if_missing = open_mode == CREATE_IF_MISSING;
options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue;
options.paranoid_checks = true;
- leveldb::DB* db;
leveldb::Status status =
- leveldb::DB::Open(options, path_.AsUTF8Unsafe(), &db);
+ leveldb_env::OpenDB(options, path_.AsUTF8Unsafe(), &db_);
UMA_HISTOGRAM_ENUMERATION("GCM.Database.Open",
leveldb_env::GetLevelDBStatusUMAValue(status),
leveldb_env::LEVELDB_STATUS_MAX);
@@ -315,7 +314,6 @@ LoadStatus GCMStoreImpl::Backend::OpenStoreAndLoadData(StoreOpenMode open_mode,
return OPENING_STORE_FAILED;
}
- db_.reset(db);
if (!LoadDeviceCredentials(&result->device_android_id,
&result->device_security_token)) {
return LOADING_DEVICE_CREDENTIALS_FAILED;
« no previous file with comments | « extensions/browser/value_store/leveldb_value_store.cc ('k') | storage/browser/fileapi/sandbox_directory_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698