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

Unified Diff: chrome/browser/android/history_report/delta_file_backend_leveldb.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 | « PRESUBMIT.py ('k') | chrome/browser/android/history_report/usage_reports_buffer_backend.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/history_report/delta_file_backend_leveldb.cc
diff --git a/chrome/browser/android/history_report/delta_file_backend_leveldb.cc b/chrome/browser/android/history_report/delta_file_backend_leveldb.cc
index 1ded0791c45f9aea74dd393fd96963e4415f9a48..4dff7767e3d688ae0588f09409fe036e07044065 100644
--- a/chrome/browser/android/history_report/delta_file_backend_leveldb.cc
+++ b/chrome/browser/android/history_report/delta_file_backend_leveldb.cc
@@ -12,6 +12,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/android/history_report/delta_file_commons.h"
+#include "third_party/leveldatabase/env_chromium.h"
#include "third_party/leveldatabase/src/include/leveldb/comparator.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
#include "third_party/leveldatabase/src/include/leveldb/iterator.h"
@@ -95,16 +96,14 @@ bool DeltaFileBackend::Init() {
options.max_open_files = 0; // Use minimum number of files.
options.comparator = leveldb_cmp_.get();
std::string path = path_.value();
- leveldb::DB* db = NULL;
- leveldb::Status status = leveldb::DB::Open(options, path, &db);
+ leveldb::Status status = leveldb_env::OpenDB(options, path, &db_);
if (status.IsCorruption()) {
LOG(WARNING) << "Deleting possibly-corrupt database";
base::DeleteFile(path_, true);
- status = leveldb::DB::Open(options, path, &db);
+ status = leveldb_env::OpenDB(options, path, &db_);
}
if (status.ok()) {
- CHECK(db);
- db_.reset(db);
+ CHECK(db_);
return true;
}
LOG(WARNING) << "Unable to open " << path_.value() << ": "
« no previous file with comments | « PRESUBMIT.py ('k') | chrome/browser/android/history_report/usage_reports_buffer_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698