| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/level_db_wrapper_impl.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 | |
| 9 namespace content { | |
| 10 | |
| 11 LevelDBWrapperImpl::LevelDBWrapperImpl( | |
| 12 const std::string& prefix, const base::Closure& no_bindings_callback) | |
| 13 : prefix_(prefix), no_bindings_callback_(no_bindings_callback) { | |
| 14 bindings_.set_connection_error_handler(base::Bind( | |
| 15 &LevelDBWrapperImpl::OnConnectionError, base::Unretained(this))); | |
| 16 } | |
| 17 | |
| 18 void LevelDBWrapperImpl::Bind(mojo::InterfaceRequest<LevelDBWrapper> request, | |
| 19 LevelDBObserverPtr observer) { | |
| 20 // TODO(jam): store observer and call it when changes occur. | |
| 21 bindings_.AddBinding(this, std::move(request)); | |
| 22 } | |
| 23 | |
| 24 LevelDBWrapperImpl::~LevelDBWrapperImpl() { | |
| 25 no_bindings_callback_.Run(); | |
| 26 } | |
| 27 | |
| 28 void LevelDBWrapperImpl::Put(mojo::Array<uint8_t> key, | |
| 29 mojo::Array<uint8_t> value, | |
| 30 const mojo::String& source, | |
| 31 const PutCallback& callback) { | |
| 32 } | |
| 33 | |
| 34 void LevelDBWrapperImpl::Delete(mojo::Array<uint8_t> key, | |
| 35 const mojo::String& source, | |
| 36 const DeleteCallback& callback) { | |
| 37 } | |
| 38 | |
| 39 void LevelDBWrapperImpl::DeleteAll(const mojo::String& source, | |
| 40 const DeleteAllCallback& callback) { | |
| 41 } | |
| 42 | |
| 43 void LevelDBWrapperImpl::Get(mojo::Array<uint8_t> key, | |
| 44 const GetCallback& callback) { | |
| 45 } | |
| 46 | |
| 47 void LevelDBWrapperImpl::GetAll(const GetAllCallback& callback) { | |
| 48 } | |
| 49 | |
| 50 void LevelDBWrapperImpl::OnConnectionError() { | |
| 51 if (!bindings_.empty()) | |
| 52 return; | |
| 53 | |
| 54 no_bindings_callback_.Run(); | |
| 55 } | |
| 56 | |
| 57 } // namespace content | |
| OLD | NEW |