Chromium Code Reviews| Index: components/leveldb_proto/leveldb_database.cc |
| diff --git a/components/leveldb_proto/leveldb_database.cc b/components/leveldb_proto/leveldb_database.cc |
| index 9791c19d5ad9e8f3e124e2c263f52c958bf49057..40a43455a5c0e90720954417869816930763d1f8 100644 |
| --- a/components/leveldb_proto/leveldb_database.cc |
| +++ b/components/leveldb_proto/leveldb_database.cc |
| @@ -61,19 +61,15 @@ bool LevelDB::InitWithOptions(const base::FilePath& database_dir, |
| std::string path = database_dir.AsUTF8Unsafe(); |
| - leveldb::DB* db = NULL; |
| - leveldb::Status status = leveldb::DB::Open(options, path, &db); |
| + leveldb::Status status = leveldb_env::OpenDB(options, path, &db_); |
| if (open_histogram_) |
| open_histogram_->Add(leveldb_env::GetLevelDBStatusUMAValue(status)); |
| if (status.IsCorruption()) { |
| base::DeleteFile(database_dir, true); |
| - status = leveldb::DB::Open(options, path, &db); |
| + status = leveldb_env::OpenDB(options, path, &db_); |
| } |
| if (status.ok()) { |
| - CHECK(db); |
|
pwnall
2017/07/06 14:32:25
Can you please leave the CHECK in? I think CHECK(d
DmitrySkiba
2017/07/06 23:15:13
I think this is better done on OpenDB() side - I'v
|
| - db_.reset(db); |
| - |
| base::trace_event::MemoryDumpManager::GetInstance() |
| ->RegisterDumpProviderWithSequencedTaskRunner( |
| this, "LevelDB", base::SequencedTaskRunnerHandle::Get(), |
| @@ -205,12 +201,10 @@ bool LevelDB::OnMemoryDump(const base::trace_event::MemoryDumpArgs& dump_args, |
| dump->AddString("client_name", "", client_name_); |
| } |
| - // Memory is allocated from system allocator (malloc). |
| - const char* system_allocator_pool_name = |
| - base::trace_event::MemoryDumpManager::GetInstance() |
| - ->system_allocator_pool_name(); |
| - if (system_allocator_pool_name) |
| - pmd->AddSuballocation(dump->guid(), system_allocator_pool_name); |
| + // All leveldb databases are already dumped by leveldb_env::DBTracker. Add |
| + // an edge to avoid double counting. |
| + pmd->AddSuballocation(dump->guid(), |
| + leveldb_env::DBTracker::GetMemoryDumpName(db_.get())); |
| return true; |
| } |