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

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

Issue 735823004: Make ProtoDatabase properly handle failed Init (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_split.h" 13 #include "base/strings/string_split.h"
14 #include "base/threading/thread_collision_warner.h" 14 #include "base/threading/thread_collision_warner.h"
15 15
16 namespace leveldb { 16 namespace leveldb {
17 class DB; 17 class DB;
18 struct Options;
18 } // namespace leveldb 19 } // namespace leveldb
19 20
20 namespace leveldb_proto { 21 namespace leveldb_proto {
21 22
22 // Interacts with the LevelDB third party module. 23 // Interacts with the LevelDB third party module.
23 // Once constructed, function calls and destruction should all occur on the 24 // Once constructed, function calls and destruction should all occur on the
24 // same thread (not necessarily the same as the constructor). 25 // same thread (not necessarily the same as the constructor).
25 class LevelDB { 26 class LevelDB {
26 public: 27 public:
27 LevelDB(); 28 LevelDB();
28 virtual ~LevelDB(); 29 virtual ~LevelDB();
29 30
31 virtual bool InitWithOptions(const base::FilePath& database_dir,
32 const leveldb::Options& options);
30 virtual bool Init(const base::FilePath& database_dir); 33 virtual bool Init(const base::FilePath& database_dir);
31 virtual bool Save(const base::StringPairs& pairs_to_save, 34 virtual bool Save(const base::StringPairs& pairs_to_save,
32 const std::vector<std::string>& keys_to_remove); 35 const std::vector<std::string>& keys_to_remove);
33 virtual bool Load(std::vector<std::string>* entries); 36 virtual bool Load(std::vector<std::string>* entries);
34 37
35 private: 38 private:
36 DFAKE_MUTEX(thread_checker_); 39 DFAKE_MUTEX(thread_checker_);
37 scoped_ptr<leveldb::DB> db_; 40 scoped_ptr<leveldb::DB> db_;
38 }; 41 };
39 42
40 } // namespace leveldb_proto 43 } // namespace leveldb_proto
41 44
42 #endif // COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_ 45 #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