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 COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ | 5 #ifndef COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ |
6 #define COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ | 6 #define COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 27 matching lines...) Expand all Loading... |
38 // change once shipped. | 38 // change once shipped. |
39 explicit LevelDB(const char* client_name); | 39 explicit LevelDB(const char* client_name); |
40 ~LevelDB() override; | 40 ~LevelDB() override; |
41 | 41 |
42 virtual bool InitWithOptions(const base::FilePath& database_dir, | 42 virtual bool InitWithOptions(const base::FilePath& database_dir, |
43 const leveldb::Options& options); | 43 const leveldb::Options& options); |
44 virtual bool Init(const base::FilePath& database_dir); | 44 virtual bool Init(const base::FilePath& database_dir); |
45 virtual bool Save(const base::StringPairs& pairs_to_save, | 45 virtual bool Save(const base::StringPairs& pairs_to_save, |
46 const std::vector<std::string>& keys_to_remove); | 46 const std::vector<std::string>& keys_to_remove); |
47 virtual bool Load(std::vector<std::string>* entries); | 47 virtual bool Load(std::vector<std::string>* entries); |
| 48 virtual bool LoadKeys(std::vector<std::string>* keys); |
48 virtual bool Get(const std::string& key, bool* found, std::string* entry); | 49 virtual bool Get(const std::string& key, bool* found, std::string* entry); |
49 | 50 |
50 static bool Destroy(const base::FilePath& database_dir); | 51 static bool Destroy(const base::FilePath& database_dir); |
51 | 52 |
52 // base::trace_event::MemoryDumpProvider implementation. | 53 // base::trace_event::MemoryDumpProvider implementation. |
53 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& dump_args, | 54 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& dump_args, |
54 base::trace_event::ProcessMemoryDump* pmd) override; | 55 base::trace_event::ProcessMemoryDump* pmd) override; |
55 | 56 |
56 private: | 57 private: |
57 DFAKE_MUTEX(thread_checker_); | 58 DFAKE_MUTEX(thread_checker_); |
58 | 59 |
59 // The declaration order of these members matters: |db_| depends on |env_| and | 60 // The declaration order of these members matters: |db_| depends on |env_| and |
60 // therefore has to be destructed first. | 61 // therefore has to be destructed first. |
61 std::unique_ptr<leveldb::Env> env_; | 62 std::unique_ptr<leveldb::Env> env_; |
62 std::unique_ptr<leveldb::DB> db_; | 63 std::unique_ptr<leveldb::DB> db_; |
63 base::HistogramBase* open_histogram_; | 64 base::HistogramBase* open_histogram_; |
64 // Name of the client shown in chrome://tracing. | 65 // Name of the client shown in chrome://tracing. |
65 std::string client_name_; | 66 std::string client_name_; |
66 | 67 |
67 DISALLOW_COPY_AND_ASSIGN(LevelDB); | 68 DISALLOW_COPY_AND_ASSIGN(LevelDB); |
68 }; | 69 }; |
69 | 70 |
70 } // namespace leveldb_proto | 71 } // namespace leveldb_proto |
71 | 72 |
72 #endif // COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ | 73 #endif // COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ |
OLD | NEW |