OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 private: | 52 private: |
53 DISALLOW_COPY_AND_ASSIGN(LevelDBLock); | 53 DISALLOW_COPY_AND_ASSIGN(LevelDBLock); |
54 }; | 54 }; |
55 | 55 |
56 class CONTENT_EXPORT LevelDBDatabase { | 56 class CONTENT_EXPORT LevelDBDatabase { |
57 public: | 57 public: |
58 class ComparatorAdapter : public leveldb::Comparator { | 58 class ComparatorAdapter : public leveldb::Comparator { |
59 public: | 59 public: |
60 explicit ComparatorAdapter(const LevelDBComparator* comparator); | 60 explicit ComparatorAdapter(const LevelDBComparator* comparator); |
61 | 61 |
62 virtual int Compare(const leveldb::Slice& a, | 62 int Compare(const leveldb::Slice& a, |
63 const leveldb::Slice& b) const override; | 63 const leveldb::Slice& b) const override; |
64 | 64 |
65 virtual const char* Name() const override; | 65 const char* Name() const override; |
66 | 66 |
67 virtual void FindShortestSeparator(std::string* start, | 67 void FindShortestSeparator(std::string* start, |
68 const leveldb::Slice& limit) const | 68 const leveldb::Slice& limit) const override; |
69 override; | 69 void FindShortSuccessor(std::string* key) const override; |
70 virtual void FindShortSuccessor(std::string* key) const override; | |
71 | 70 |
72 private: | 71 private: |
73 const LevelDBComparator* comparator_; | 72 const LevelDBComparator* comparator_; |
74 }; | 73 }; |
75 | 74 |
76 static leveldb::Status Open(const base::FilePath& file_name, | 75 static leveldb::Status Open(const base::FilePath& file_name, |
77 const LevelDBComparator* comparator, | 76 const LevelDBComparator* comparator, |
78 scoped_ptr<LevelDBDatabase>* db, | 77 scoped_ptr<LevelDBDatabase>* db, |
79 bool* is_disk_full = 0); | 78 bool* is_disk_full = 0); |
80 static scoped_ptr<LevelDBDatabase> OpenInMemory( | 79 static scoped_ptr<LevelDBDatabase> OpenInMemory( |
(...skipping 24 matching lines...) Expand all Loading... |
105 scoped_ptr<leveldb::Env> env_; | 104 scoped_ptr<leveldb::Env> env_; |
106 scoped_ptr<leveldb::Comparator> comparator_adapter_; | 105 scoped_ptr<leveldb::Comparator> comparator_adapter_; |
107 scoped_ptr<leveldb::DB> db_; | 106 scoped_ptr<leveldb::DB> db_; |
108 scoped_ptr<const leveldb::FilterPolicy> filter_policy_; | 107 scoped_ptr<const leveldb::FilterPolicy> filter_policy_; |
109 const LevelDBComparator* comparator_; | 108 const LevelDBComparator* comparator_; |
110 }; | 109 }; |
111 | 110 |
112 } // namespace content | 111 } // namespace content |
113 | 112 |
114 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_ | 113 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_ |
OLD | NEW |