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 #include "content/browser/level_db_wrapper_impl.h" | 5 #include "content/browser/level_db_wrapper_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
11 LevelDBWrapperImpl::LevelDBWrapperImpl( | 11 LevelDBWrapperImpl::LevelDBWrapperImpl( |
12 const std::string& prefix, const base::Closure& no_bindings_callback) | 12 leveldb::LevelDBDatabase* database, |
13 : prefix_(prefix), no_bindings_callback_(no_bindings_callback) { | 13 const std::string& prefix, |
| 14 const base::Closure& no_bindings_callback) |
| 15 : prefix_(prefix), |
| 16 no_bindings_callback_(no_bindings_callback), |
| 17 database_(database) { |
14 bindings_.set_connection_error_handler(base::Bind( | 18 bindings_.set_connection_error_handler(base::Bind( |
15 &LevelDBWrapperImpl::OnConnectionError, base::Unretained(this))); | 19 &LevelDBWrapperImpl::OnConnectionError, base::Unretained(this))); |
16 } | 20 } |
17 | 21 |
18 void LevelDBWrapperImpl::Bind(mojo::InterfaceRequest<LevelDBWrapper> request, | 22 void LevelDBWrapperImpl::Bind(mojo::InterfaceRequest<LevelDBWrapper> request, |
19 LevelDBObserverPtr observer) { | 23 LevelDBObserverPtr observer) { |
20 // TODO(jam): store observer and call it when changes occur. | 24 // TODO(jam): store observer and call it when changes occur. |
21 bindings_.AddBinding(this, std::move(request)); | 25 bindings_.AddBinding(this, std::move(request)); |
22 } | 26 } |
23 | 27 |
(...skipping 24 matching lines...) Expand all Loading... |
48 } | 52 } |
49 | 53 |
50 void LevelDBWrapperImpl::OnConnectionError() { | 54 void LevelDBWrapperImpl::OnConnectionError() { |
51 if (!bindings_.empty()) | 55 if (!bindings_.empty()) |
52 return; | 56 return; |
53 | 57 |
54 no_bindings_callback_.Run(); | 58 no_bindings_callback_.Run(); |
55 } | 59 } |
56 | 60 |
57 } // namespace content | 61 } // namespace content |
OLD | NEW |