| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef EXTENSIONS_BROWSER_VALUE_STORE_LAZY_LEVELDB_H_ | 5 #ifndef EXTENSIONS_BROWSER_VALUE_STORE_LAZY_LEVELDB_H_ |
| 6 #define EXTENSIONS_BROWSER_VALUE_STORE_LAZY_LEVELDB_H_ | 6 #define EXTENSIONS_BROWSER_VALUE_STORE_LAZY_LEVELDB_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // be returned and value will be unchanged. Caller must ensure the database is | 55 // be returned and value will be unchanged. Caller must ensure the database is |
| 56 // open before calling this method. | 56 // open before calling this method. |
| 57 ValueStore::Status Read(const std::string& key, | 57 ValueStore::Status Read(const std::string& key, |
| 58 std::unique_ptr<base::Value>* value); | 58 std::unique_ptr<base::Value>* value); |
| 59 | 59 |
| 60 // Opens the underlying database if not yet open. If the open fails due to | 60 // Opens the underlying database if not yet open. If the open fails due to |
| 61 // corruption will attempt to repair the database. Failing that, will attempt | 61 // corruption will attempt to repair the database. Failing that, will attempt |
| 62 // to delete the database. Will only attempt a single recovery. | 62 // to delete the database. Will only attempt a single recovery. |
| 63 ValueStore::Status EnsureDbIsOpen(); | 63 ValueStore::Status EnsureDbIsOpen(); |
| 64 | 64 |
| 65 const std::string& open_histogram_name() const { | 65 const char* open_histogram_name() const { |
| 66 return open_histogram_->histogram_name(); | 66 return open_histogram_->histogram_name(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 leveldb::DB* db() { return db_.get(); } | 69 leveldb::DB* db() { return db_.get(); } |
| 70 | 70 |
| 71 const leveldb::ReadOptions& read_options() const { return read_options_; } | 71 const leveldb::ReadOptions& read_options() const { return read_options_; } |
| 72 | 72 |
| 73 const leveldb::WriteOptions& write_options() const { return write_options_; } | 73 const leveldb::WriteOptions& write_options() const { return write_options_; } |
| 74 | 74 |
| 75 private: | 75 private: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 91 bool db_unrecoverable_ = false; | 91 bool db_unrecoverable_ = false; |
| 92 // Used for UMA logging. | 92 // Used for UMA logging. |
| 93 base::HistogramBase* open_histogram_ = nullptr; | 93 base::HistogramBase* open_histogram_ = nullptr; |
| 94 base::HistogramBase* db_restore_histogram_ = nullptr; | 94 base::HistogramBase* db_restore_histogram_ = nullptr; |
| 95 base::HistogramBase* value_restore_histogram_ = nullptr; | 95 base::HistogramBase* value_restore_histogram_ = nullptr; |
| 96 | 96 |
| 97 DISALLOW_COPY_AND_ASSIGN(LazyLevelDb); | 97 DISALLOW_COPY_AND_ASSIGN(LazyLevelDb); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 #endif // EXTENSIONS_BROWSER_VALUE_STORE_LAZY_LEVELDB_H_ | 100 #endif // EXTENSIONS_BROWSER_VALUE_STORE_LAZY_LEVELDB_H_ |
| OLD | NEW |