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/leveldb_wrapper_impl.h" | 5 #include "content/browser/leveldb_wrapper_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "mojo/common/common_type_converters.h" | 8 #include "mojo/common/common_type_converters.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 10 matching lines...) Expand all Loading... |
21 max_size_(max_size) { | 21 max_size_(max_size) { |
22 bindings_.set_connection_error_handler(base::Bind( | 22 bindings_.set_connection_error_handler(base::Bind( |
23 &LevelDBWrapperImpl::OnConnectionError, base::Unretained(this))); | 23 &LevelDBWrapperImpl::OnConnectionError, base::Unretained(this))); |
24 } | 24 } |
25 | 25 |
26 void LevelDBWrapperImpl::Bind(mojom::LevelDBWrapperRequest request) { | 26 void LevelDBWrapperImpl::Bind(mojom::LevelDBWrapperRequest request) { |
27 bindings_.AddBinding(this, std::move(request)); | 27 bindings_.AddBinding(this, std::move(request)); |
28 } | 28 } |
29 | 29 |
30 void LevelDBWrapperImpl::AddObserver(mojom::LevelDBObserverPtr observer) { | 30 void LevelDBWrapperImpl::AddObserver(mojom::LevelDBObserverPtr observer) { |
31 observers_.AddInterfacePtr(std::move(observer)); | 31 observers_.AddPtr(std::move(observer)); |
32 } | 32 } |
33 | 33 |
34 LevelDBWrapperImpl::~LevelDBWrapperImpl() {} | 34 LevelDBWrapperImpl::~LevelDBWrapperImpl() {} |
35 | 35 |
36 void LevelDBWrapperImpl::Put(mojo::Array<uint8_t> key, | 36 void LevelDBWrapperImpl::Put(mojo::Array<uint8_t> key, |
37 mojo::Array<uint8_t> value, | 37 mojo::Array<uint8_t> value, |
38 const mojo::String& source, | 38 const mojo::String& source, |
39 const PutCallback& callback) { | 39 const PutCallback& callback) { |
40 bool has_old_item = false; | 40 bool has_old_item = false; |
41 mojo::Array<uint8_t> old_value; | 41 mojo::Array<uint8_t> old_value; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 void LevelDBWrapperImpl::OnConnectionError() { | 136 void LevelDBWrapperImpl::OnConnectionError() { |
137 if (!bindings_.empty()) | 137 if (!bindings_.empty()) |
138 return; | 138 return; |
139 | 139 |
140 no_bindings_callback_.Run(); | 140 no_bindings_callback_.Run(); |
141 } | 141 } |
142 | 142 |
143 } // namespace content | 143 } // namespace content |
OLD | NEW |