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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/trace_event/memory_dump_provider.h" | 17 #include "base/trace_event/memory_dump_provider.h" |
18 #include "extensions/browser/value_store/lazy_leveldb.h" | 18 #include "extensions/browser/value_store/lazy_leveldb.h" |
19 #include "extensions/browser/value_store/value_store.h" | 19 #include "extensions/browser/value_store/value_store.h" |
20 #include "third_party/leveldatabase/src/include/leveldb/db.h" | 20 #include "third_party/leveldatabase/src/include/leveldb/db.h" |
21 | 21 |
22 namespace base { | |
23 class HistogramBase; | |
24 } // namespace base | |
25 | |
26 // Value store area, backed by a leveldb database. | 22 // Value store area, backed by a leveldb database. |
27 // All methods must be run on the FILE thread. | 23 // All methods must be run on the FILE thread. |
28 class LeveldbValueStore : public ValueStore, | 24 class LeveldbValueStore : public ValueStore, |
29 public LazyLevelDb, | 25 public LazyLevelDb, |
30 public base::trace_event::MemoryDumpProvider { | 26 public base::trace_event::MemoryDumpProvider { |
31 public: | 27 public: |
32 // Creates a database bound to |path|. The underlying database won't be | 28 // Creates a database bound to |path|. The underlying database won't be |
33 // opened (i.e. may not be created) until one of the get/set/etc methods are | 29 // opened (i.e. may not be created) until one of the get/set/etc methods are |
34 // called - this is because opening the database may fail, and extensions | 30 // called - this is because opening the database may fail, and extensions |
35 // need to be notified of that, but we don't want to permanently give up. | 31 // need to be notified of that, but we don't want to permanently give up. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 leveldb::WriteBatch* batch, | 70 leveldb::WriteBatch* batch, |
75 ValueStoreChangeList* changes); | 71 ValueStoreChangeList* changes); |
76 | 72 |
77 // Commits the changes in |batch| to the database. | 73 // Commits the changes in |batch| to the database. |
78 ValueStore::Status WriteToDb(leveldb::WriteBatch* batch); | 74 ValueStore::Status WriteToDb(leveldb::WriteBatch* batch); |
79 | 75 |
80 DISALLOW_COPY_AND_ASSIGN(LeveldbValueStore); | 76 DISALLOW_COPY_AND_ASSIGN(LeveldbValueStore); |
81 }; | 77 }; |
82 | 78 |
83 #endif // EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_VALUE_STORE_H_ | 79 #endif // EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_VALUE_STORE_H_ |
OLD | NEW |