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 12 matching lines...) Expand all Loading... |
23 // called - this is because opening the database may fail, and extensions | 23 // called - this is because opening the database may fail, and extensions |
24 // need to be notified of that, but we don't want to permanently give up. | 24 // need to be notified of that, but we don't want to permanently give up. |
25 // | 25 // |
26 // Must be created on the FILE thread. | 26 // Must be created on the FILE thread. |
27 explicit LeveldbValueStore(const base::FilePath& path); | 27 explicit LeveldbValueStore(const base::FilePath& path); |
28 | 28 |
29 // Must be deleted on the FILE thread. | 29 // Must be deleted on the FILE thread. |
30 virtual ~LeveldbValueStore(); | 30 virtual ~LeveldbValueStore(); |
31 | 31 |
32 // ValueStore implementation. | 32 // ValueStore implementation. |
33 virtual size_t GetBytesInUse(const std::string& key) OVERRIDE; | 33 virtual size_t GetBytesInUse(const std::string& key) override; |
34 virtual size_t GetBytesInUse(const std::vector<std::string>& keys) OVERRIDE; | 34 virtual size_t GetBytesInUse(const std::vector<std::string>& keys) override; |
35 virtual size_t GetBytesInUse() OVERRIDE; | 35 virtual size_t GetBytesInUse() override; |
36 virtual ReadResult Get(const std::string& key) OVERRIDE; | 36 virtual ReadResult Get(const std::string& key) override; |
37 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; | 37 virtual ReadResult Get(const std::vector<std::string>& keys) override; |
38 virtual ReadResult Get() OVERRIDE; | 38 virtual ReadResult Get() override; |
39 virtual WriteResult Set( | 39 virtual WriteResult Set( |
40 WriteOptions options, | 40 WriteOptions options, |
41 const std::string& key, | 41 const std::string& key, |
42 const base::Value& value) OVERRIDE; | 42 const base::Value& value) override; |
43 virtual WriteResult Set( | 43 virtual WriteResult Set( |
44 WriteOptions options, const base::DictionaryValue& values) OVERRIDE; | 44 WriteOptions options, const base::DictionaryValue& values) override; |
45 virtual WriteResult Remove(const std::string& key) OVERRIDE; | 45 virtual WriteResult Remove(const std::string& key) override; |
46 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE; | 46 virtual WriteResult Remove(const std::vector<std::string>& keys) override; |
47 virtual WriteResult Clear() OVERRIDE; | 47 virtual WriteResult Clear() override; |
48 virtual bool Restore() OVERRIDE; | 48 virtual bool Restore() override; |
49 virtual bool RestoreKey(const std::string& key) OVERRIDE; | 49 virtual bool RestoreKey(const std::string& key) override; |
50 | 50 |
51 // Write directly to the backing levelDB. Only used for testing to cause | 51 // Write directly to the backing levelDB. Only used for testing to cause |
52 // corruption in the database. | 52 // corruption in the database. |
53 bool WriteToDbForTest(leveldb::WriteBatch* batch); | 53 bool WriteToDbForTest(leveldb::WriteBatch* batch); |
54 | 54 |
55 private: | 55 private: |
56 // Tries to open the database if it hasn't been opened already. | 56 // Tries to open the database if it hasn't been opened already. |
57 scoped_ptr<ValueStore::Error> EnsureDbIsOpen(); | 57 scoped_ptr<ValueStore::Error> EnsureDbIsOpen(); |
58 | 58 |
59 // Reads a setting from the database. | 59 // Reads a setting from the database. |
(...skipping 30 matching lines...) Expand all Loading... |
90 // The location of the leveldb backend. | 90 // The location of the leveldb backend. |
91 const base::FilePath db_path_; | 91 const base::FilePath db_path_; |
92 | 92 |
93 // leveldb backend. | 93 // leveldb backend. |
94 scoped_ptr<leveldb::DB> db_; | 94 scoped_ptr<leveldb::DB> db_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(LeveldbValueStore); | 96 DISALLOW_COPY_AND_ASSIGN(LeveldbValueStore); |
97 }; | 97 }; |
98 | 98 |
99 #endif // EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_VALUE_STORE_H_ | 99 #endif // EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_VALUE_STORE_H_ |
OLD | NEW |