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

Unified Diff: content/browser/indexed_db/leveldb/leveldb_database.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: content/browser/indexed_db/leveldb/leveldb_database.cc
diff --git a/content/browser/indexed_db/leveldb/leveldb_database.cc b/content/browser/indexed_db/leveldb/leveldb_database.cc
index 541cf3bff2b5aa0aaea41056b1332b0b092b3128..2e61cfd267d34a2edbbde97523c45a10a6b83411 100644
--- a/content/browser/indexed_db/leveldb/leveldb_database.cc
+++ b/content/browser/indexed_db/leveldb/leveldb_database.cc
@@ -155,11 +155,7 @@ static leveldb::Status OpenDB(
options.block_cache = default_block_cache;
// ChromiumEnv assumes UTF8, converts back to FilePath before using.
- leveldb::DB* db_ptr = nullptr;
- leveldb::Status s = leveldb::DB::Open(options, path.AsUTF8Unsafe(), &db_ptr);
- db->reset(db_ptr);
-
- return s;
+ return leveldb_env::OpenDB(options, path.AsUTF8Unsafe(), db);
}
leveldb::Status LevelDBDatabase::Destroy(const base::FilePath& file_name) {
@@ -506,10 +502,11 @@ bool LevelDBDatabase::OnMemoryDump(
dump->AddString("file_name", "", file_name_for_tracing);
- // Memory is allocated from system allocator (malloc).
+ // All leveldb databases are already dumped by leveldb_env::DBTracker. Add
+ // an edge to avoid double counting.
pmd->AddSuballocation(dump->guid(),
- base::trace_event::MemoryDumpManager::GetInstance()
- ->system_allocator_pool_name());
+ leveldb_env::DBTracker::GetMemoryDumpName(db_.get()));
+
return true;
}
« no previous file with comments | « content/browser/dom_storage/session_storage_database.cc ('k') | content/browser/notifications/notification_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698