Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: content/browser/leveldb_wrapper_impl.cc

Issue 1745603002: Switch LevelDBWrapper::GetAll to use the new Mojo sync IPC mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/leveldb_wrapper_impl.h ('k') | content/browser/storage_partition_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/leveldb_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 const std::string& prefix, const base::Closure& no_bindings_callback)
13 : prefix_(prefix), no_bindings_callback_(no_bindings_callback) { 13 : prefix_(prefix), no_bindings_callback_(no_bindings_callback) {
14 bindings_.set_connection_error_handler(base::Bind( 14 bindings_.set_connection_error_handler(base::Bind(
15 &LevelDBWrapperImpl::OnConnectionError, base::Unretained(this))); 15 &LevelDBWrapperImpl::OnConnectionError, base::Unretained(this)));
16 } 16 }
17 17
18 void LevelDBWrapperImpl::Bind(mojo::InterfaceRequest<LevelDBWrapper> request, 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)); 19 bindings_.AddBinding(this, std::move(request));
22 } 20 }
23 21
24 LevelDBWrapperImpl::~LevelDBWrapperImpl() { 22 LevelDBWrapperImpl::~LevelDBWrapperImpl() {
25 no_bindings_callback_.Run(); 23 no_bindings_callback_.Run();
michaeln 2016/03/01 22:26:14 also, this call looks fishy, looks like we can cal
jam 2016/03/02 06:21:20 ah yes, fixed thanks.
26 } 24 }
27 25
28 void LevelDBWrapperImpl::Put(mojo::Array<uint8_t> key, 26 void LevelDBWrapperImpl::Put(mojo::Array<uint8_t> key,
29 mojo::Array<uint8_t> value, 27 mojo::Array<uint8_t> value,
30 const mojo::String& source, 28 const mojo::String& source,
31 const PutCallback& callback) { 29 const PutCallback& callback) {
32 } 30 }
33 31
34 void LevelDBWrapperImpl::Delete(mojo::Array<uint8_t> key, 32 void LevelDBWrapperImpl::Delete(mojo::Array<uint8_t> key,
35 const mojo::String& source, 33 const mojo::String& source,
36 const DeleteCallback& callback) { 34 const DeleteCallback& callback) {
37 } 35 }
38 36
39 void LevelDBWrapperImpl::DeleteAll(const mojo::String& source, 37 void LevelDBWrapperImpl::DeleteAll(LevelDBObserverPtr observer,
38 const mojo::String& source,
40 const DeleteAllCallback& callback) { 39 const DeleteAllCallback& callback) {
40 // TODO(jam): store observer and call it when changes occur.
41 } 41 }
42 42
43 void LevelDBWrapperImpl::Get(mojo::Array<uint8_t> key, 43 void LevelDBWrapperImpl::Get(mojo::Array<uint8_t> key,
44 const GetCallback& callback) { 44 const GetCallback& callback) {
45 } 45 }
46 46
47 void LevelDBWrapperImpl::GetAll(const GetAllCallback& callback) { 47 void LevelDBWrapperImpl::GetAll(LevelDBObserverPtr observer,
48 const GetAllCallback& callback) {
49 // TODO(jam): store observer and call it when changes occur.
48 } 50 }
49 51
50 void LevelDBWrapperImpl::OnConnectionError() { 52 void LevelDBWrapperImpl::OnConnectionError() {
51 if (!bindings_.empty()) 53 if (!bindings_.empty())
52 return; 54 return;
53 55
54 no_bindings_callback_.Run(); 56 no_bindings_callback_.Run();
55 } 57 }
56 58
57 } // namespace content 59 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/leveldb_wrapper_impl.h ('k') | content/browser/storage_partition_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698