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 #ifndef EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_VALUE_STORE_H_ | 5 #ifndef EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_VALUE_STORE_H_ |
6 #define EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_VALUE_STORE_H_ | 6 #define EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_VALUE_STORE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 scoped_ptr<ValueStore::Error> WriteToDb(leveldb::WriteBatch* batch); | 85 scoped_ptr<ValueStore::Error> WriteToDb(leveldb::WriteBatch* batch); |
86 | 86 |
87 // Converts an error leveldb::Status to a ValueStore::Error. Returns a | 87 // Converts an error leveldb::Status to a ValueStore::Error. Returns a |
88 // scoped_ptr for convenience; the result will always be non-empty. | 88 // scoped_ptr for convenience; the result will always be non-empty. |
89 scoped_ptr<ValueStore::Error> ToValueStoreError( | 89 scoped_ptr<ValueStore::Error> ToValueStoreError( |
90 const leveldb::Status& status, | 90 const leveldb::Status& status, |
91 scoped_ptr<std::string> key); | 91 scoped_ptr<std::string> key); |
92 | 92 |
93 // Removes the on-disk database at |db_path_|. Any file system locks should | 93 // Removes the on-disk database at |db_path_|. Any file system locks should |
94 // be released before calling this method. | 94 // be released before calling this method. |
95 void DeleteDbFile(); | 95 bool DeleteDbFile(); |
96 | 96 |
97 // Returns whether the database is empty. | 97 // Returns whether the database is empty. |
98 bool IsEmpty(); | 98 bool IsEmpty(); |
99 | 99 |
100 // The location of the leveldb backend. | 100 // The location of the leveldb backend. |
101 const base::FilePath db_path_; | 101 const base::FilePath db_path_; |
102 | 102 |
103 // leveldb backend. | 103 // leveldb backend. |
104 scoped_ptr<leveldb::DB> db_; | 104 scoped_ptr<leveldb::DB> db_; |
105 base::HistogramBase* open_histogram_; | 105 base::HistogramBase* open_histogram_; |
| 106 base::HistogramBase* restore_histogram_; |
106 | 107 |
107 DISALLOW_COPY_AND_ASSIGN(LeveldbValueStore); | 108 DISALLOW_COPY_AND_ASSIGN(LeveldbValueStore); |
108 }; | 109 }; |
109 | 110 |
110 #endif // EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_VALUE_STORE_H_ | 111 #endif // EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_VALUE_STORE_H_ |
OLD | NEW |