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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/containers/mru_cache.h" | |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
14 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
15 #include "base/trace_event/memory_dump_provider.h" | 16 #include "base/trace_event/memory_dump_provider.h" |
16 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
17 #include "third_party/leveldatabase/src/include/leveldb/comparator.h" | 18 #include "third_party/leveldatabase/src/include/leveldb/comparator.h" |
18 #include "third_party/leveldatabase/src/include/leveldb/status.h" | 19 #include "third_party/leveldatabase/src/include/leveldb/status.h" |
19 | 20 |
20 namespace leveldb { | 21 namespace leveldb { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 leveldb::Status Write(const LevelDBWriteBatch& write_batch); | 96 leveldb::Status Write(const LevelDBWriteBatch& write_batch); |
96 std::unique_ptr<LevelDBIterator> CreateIterator(const LevelDBSnapshot* = 0); | 97 std::unique_ptr<LevelDBIterator> CreateIterator(const LevelDBSnapshot* = 0); |
97 const LevelDBComparator* Comparator() const; | 98 const LevelDBComparator* Comparator() const; |
98 void Compact(const base::StringPiece& start, const base::StringPiece& stop); | 99 void Compact(const base::StringPiece& start, const base::StringPiece& stop); |
99 void CompactAll(); | 100 void CompactAll(); |
100 | 101 |
101 // base::trace_event::MemoryDumpProvider implementation. | 102 // base::trace_event::MemoryDumpProvider implementation. |
102 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 103 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
103 base::trace_event::ProcessMemoryDump* pmd) override; | 104 base::trace_event::ProcessMemoryDump* pmd) override; |
104 | 105 |
106 void NotifyIteratorUsed(LevelDBIterator*); | |
107 void NotifyIteratorDestroyed(LevelDBIterator*); | |
108 | |
105 protected: | 109 protected: |
106 LevelDBDatabase(); | 110 LevelDBDatabase(); |
107 | 111 |
108 private: | 112 private: |
109 friend class LevelDBSnapshot; | 113 friend class LevelDBSnapshot; |
110 | 114 |
111 void CloseDatabase(); | 115 void CloseDatabase(); |
112 | 116 |
113 std::unique_ptr<leveldb::Env> env_; | 117 std::unique_ptr<leveldb::Env> env_; |
114 std::unique_ptr<leveldb::Comparator> comparator_adapter_; | 118 std::unique_ptr<leveldb::Comparator> comparator_adapter_; |
115 std::unique_ptr<leveldb::DB> db_; | 119 std::unique_ptr<leveldb::DB> db_; |
116 std::unique_ptr<const leveldb::FilterPolicy> filter_policy_; | 120 std::unique_ptr<const leveldb::FilterPolicy> filter_policy_; |
117 const LevelDBComparator* comparator_; | 121 const LevelDBComparator* comparator_; |
122 base::MRUCache<LevelDBIterator*, LevelDBIterator*> iterator_lru_; | |
jsbell
2017/03/21 00:15:48
MRU vs lru ?
dmurph
2017/03/21 20:13:26
Incorrect type name. Very annoying for me haha.
| |
123 | |
118 std::string file_name_for_tracing; | 124 std::string file_name_for_tracing; |
119 }; | 125 }; |
120 | 126 |
121 } // namespace content | 127 } // namespace content |
122 | 128 |
123 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_ | 129 #endif // CONTENT_BROWSER_INDEXED_DB_LEVELDB_LEVELDB_DATABASE_H_ |
OLD | NEW |