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

Unified Diff: components/data_reduction_proxy/core/browser/data_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: components/data_reduction_proxy/core/browser/data_store_impl.cc
diff --git a/components/data_reduction_proxy/core/browser/data_store_impl.cc b/components/data_reduction_proxy/core/browser/data_store_impl.cc
index 3c7c180fe9637de40870512c7d6720da7014f965..564b70b721b4866834277a1ae4ca9d1a4351b0dc 100644
--- a/components/data_reduction_proxy/core/browser/data_store_impl.cc
+++ b/components/data_reduction_proxy/core/browser/data_store_impl.cc
@@ -121,17 +121,15 @@ DataStore::Status DataStoreImpl::OpenDB() {
// these log entries are deleted.
options.reuse_logs = false;
std::string db_name = profile_path_.Append(kDBName).AsUTF8Unsafe();
- leveldb::DB* dbptr = nullptr;
+ db_.reset();
Status status =
- LevelDbToDRPStoreStatus(leveldb::DB::Open(options, db_name, &dbptr));
+ LevelDbToDRPStoreStatus(leveldb_env::OpenDB(options, db_name, &db_));
UMA_HISTOGRAM_ENUMERATION("DataReductionProxy.LevelDBOpenStatus", status,
STATUS_MAX);
if (status != OK)
LOG(ERROR) << "Failed to open Data Reduction Proxy DB: " << status;
- db_.reset(dbptr);
-
if (db_) {
leveldb::Range range;
uint64_t size;
@@ -139,7 +137,7 @@ DataStore::Status DataStoreImpl::OpenDB() {
// lowest keys.
range.start = "";
range.limit = "z"; // Keys starting with 'z' will not be included.
- dbptr->GetApproximateSizes(&range, 1, &size);
+ db_->GetApproximateSizes(&range, 1, &size);
UMA_HISTOGRAM_MEMORY_KB("DataReductionProxy.LevelDBSize", size / 1024);
}
« no previous file with comments | « chrome/browser/sync_file_system/local/local_file_change_tracker.cc ('k') | components/drive/resource_metadata_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698