OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_LEVEL_DB_WRAPPER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_LEVEL_DB_WRAPPER_IMPL_H_ |
6 #define CONTENT_BROWSER_LEVEL_DB_WRAPPER_IMPL_H_ | 6 #define CONTENT_BROWSER_LEVEL_DB_WRAPPER_IMPL_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "content/common/leveldb_wrapper.mojom.h" | 10 #include "content/common/leveldb_wrapper.mojom.h" |
11 #include "mojo/public/cpp/bindings/weak_binding_set.h" | 11 #include "mojo/public/cpp/bindings/binding_set.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 // This is a wrapper around a leveldb::LevelDBDatabase. It adds a couple of | 15 // This is a wrapper around a leveldb::LevelDBDatabase. It adds a couple of |
16 // features: | 16 // features: |
17 // 1) Adds the given prefix, if any, to all keys. This allows the sharing of one | 17 // 1) Adds the given prefix, if any, to all keys. This allows the sharing of one |
18 // database across many, possibly untrusted, consumers and ensuring that they | 18 // database across many, possibly untrusted, consumers and ensuring that they |
19 // can't access each other's values. | 19 // can't access each other's values. |
20 // 2) Informs an observer when the given prefix' values are modified by another | 20 // 2) Informs an observer when the given prefix' values are modified by another |
21 // process. | 21 // process. |
(...skipping 19 matching lines...) Expand all Loading... |
41 const mojo::String& source, | 41 const mojo::String& source, |
42 const DeleteCallback& callback) override; | 42 const DeleteCallback& callback) override; |
43 void DeleteAll(const mojo::String& source, | 43 void DeleteAll(const mojo::String& source, |
44 const DeleteAllCallback& callback) override; | 44 const DeleteAllCallback& callback) override; |
45 void Get(mojo::Array<uint8_t> key, const GetCallback& callback) override; | 45 void Get(mojo::Array<uint8_t> key, const GetCallback& callback) override; |
46 void GetAll(const GetAllCallback& callback) override; | 46 void GetAll(const GetAllCallback& callback) override; |
47 | 47 |
48 void OnConnectionError(); | 48 void OnConnectionError(); |
49 | 49 |
50 std::string prefix_; | 50 std::string prefix_; |
51 mojo::WeakBindingSet<LevelDBWrapper> bindings_; | 51 mojo::BindingSet<LevelDBWrapper> bindings_; |
52 base::Closure no_bindings_callback_; | 52 base::Closure no_bindings_callback_; |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapperImpl); | 54 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapperImpl); |
55 }; | 55 }; |
56 | 56 |
57 } // namespace content | 57 } // namespace content |
58 | 58 |
59 #endif // CONTENT_BROWSER_LEVEL_DB_WRAPPER_IMPL_H_ | 59 #endif // CONTENT_BROWSER_LEVEL_DB_WRAPPER_IMPL_H_ |
OLD | NEW |