Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: components/leveldb_proto/leveldb_database.h

Issue 2379113002: Extended the ProtoDatabase to provide LoadKeys() functionality. (Closed)
Patch Set: Garbage Collect orphaned images on service start-up. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/leveldb_proto/leveldb_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « no previous file | components/leveldb_proto/leveldb_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698