[Cronet] Delay StartNetLog and StopNetLog until native request context is initialized
[chromium-blink-merge.git] / components / leveldb_proto / leveldb_database.h
blobfaa8199fe1dde43508d08654db7c17a0c09d6a32
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_
6 #define COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_
8 #include <string>
9 #include <vector>
11 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_split.h"
14 #include "base/threading/thread_collision_warner.h"
16 namespace leveldb {
17 class DB;
18 struct Options;
19 } // namespace leveldb
21 namespace leveldb_proto {
23 // Interacts with the LevelDB third party module.
24 // Once constructed, function calls and destruction should all occur on the
25 // same thread (not necessarily the same as the constructor).
26 class LevelDB {
27 public:
28 LevelDB();
29 virtual ~LevelDB();
31 virtual bool InitWithOptions(const base::FilePath& database_dir,
32 const leveldb::Options& options);
33 virtual bool Init(const base::FilePath& database_dir);
34 virtual bool Save(const base::StringPairs& pairs_to_save,
35 const std::vector<std::string>& keys_to_remove);
36 virtual bool Load(std::vector<std::string>* entries);
38 private:
39 DFAKE_MUTEX(thread_checker_);
40 scoped_ptr<leveldb::DB> db_;
43 } // namespace leveldb_proto
45 #endif // COMPONENTS_LEVELDB_PROTO_LEVELDB_DATABASE_H_