| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/leveldb_proto/leveldb_database.h" | 5 #include "components/leveldb_proto/leveldb_database.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 this); | 55 this); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool LevelDB::InitWithOptions(const base::FilePath& database_dir, | 58 bool LevelDB::InitWithOptions(const base::FilePath& database_dir, |
| 59 const leveldb::Options& options) { | 59 const leveldb::Options& options) { |
| 60 DFAKE_SCOPED_LOCK(thread_checker_); | 60 DFAKE_SCOPED_LOCK(thread_checker_); |
| 61 | 61 |
| 62 std::string path = database_dir.AsUTF8Unsafe(); | 62 std::string path = database_dir.AsUTF8Unsafe(); |
| 63 | 63 |
| 64 leveldb::DB* db = NULL; | 64 leveldb::DB* db = NULL; |
| 65 leveldb::Status status = leveldb::DB::Open(options, path, &db); | 65 leveldb::Status status = leveldb_env::DBRegistry::Open(options, path, &db); |
| 66 if (open_histogram_) | 66 if (open_histogram_) |
| 67 open_histogram_->Add(leveldb_env::GetLevelDBStatusUMAValue(status)); | 67 open_histogram_->Add(leveldb_env::GetLevelDBStatusUMAValue(status)); |
| 68 if (status.IsCorruption()) { | 68 if (status.IsCorruption()) { |
| 69 base::DeleteFile(database_dir, true); | 69 base::DeleteFile(database_dir, true); |
| 70 status = leveldb::DB::Open(options, path, &db); | 70 status = leveldb_env::DBRegistry::Open(options, path, &db); |
| 71 } | 71 } |
| 72 | 72 |
| 73 if (status.ok()) { | 73 if (status.ok()) { |
| 74 CHECK(db); | 74 CHECK(db); |
| 75 db_.reset(db); | 75 db_.reset(db); |
| 76 | 76 |
| 77 base::trace_event::MemoryDumpManager::GetInstance() | 77 base::trace_event::MemoryDumpManager::GetInstance() |
| 78 ->RegisterDumpProviderWithSequencedTaskRunner( | 78 ->RegisterDumpProviderWithSequencedTaskRunner( |
| 79 this, "LevelDB", base::SequencedTaskRunnerHandle::Get(), | 79 this, "LevelDB", base::SequencedTaskRunnerHandle::Get(), |
| 80 base::trace_event::MemoryDumpProvider::Options()); | 80 base::trace_event::MemoryDumpProvider::Options()); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 const char* system_allocator_pool_name = | 209 const char* system_allocator_pool_name = |
| 210 base::trace_event::MemoryDumpManager::GetInstance() | 210 base::trace_event::MemoryDumpManager::GetInstance() |
| 211 ->system_allocator_pool_name(); | 211 ->system_allocator_pool_name(); |
| 212 if (system_allocator_pool_name) | 212 if (system_allocator_pool_name) |
| 213 pmd->AddSuballocation(dump->guid(), system_allocator_pool_name); | 213 pmd->AddSuballocation(dump->guid(), system_allocator_pool_name); |
| 214 | 214 |
| 215 return true; | 215 return true; |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace leveldb_proto | 218 } // namespace leveldb_proto |
| OLD | NEW |