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

Side by Side Diff: components/leveldb/leveldb_database_impl.cc

Issue 1737933002: mojo leveldb: Get profile and leveldb connected to DOMStorageContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge tot 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
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 "components/leveldb/leveldb_database_impl.h" 5 #include "components/leveldb/leveldb_database_impl.h"
6 6
7 #include "base/rand_util.h" 7 #include "base/rand_util.h"
8 #include "components/leveldb/env_mojo.h" 8 #include "components/leveldb/env_mojo.h"
9 #include "components/leveldb/util.h" 9 #include "components/leveldb/util.h"
10 #include "mojo/common/common_type_converters.h" 10 #include "mojo/common/common_type_converters.h"
(...skipping 10 matching lines...) Expand all
21 uint64_t new_id = base::RandUint64(); 21 uint64_t new_id = base::RandUint64();
22 while ((new_id == 0) || (m.find(new_id) != m.end())) 22 while ((new_id == 0) || (m.find(new_id) != m.end()))
23 new_id = base::RandUint64(); 23 new_id = base::RandUint64();
24 24
25 return new_id; 25 return new_id;
26 } 26 }
27 27
28 } // namespace 28 } // namespace
29 29
30 LevelDBDatabaseImpl::LevelDBDatabaseImpl( 30 LevelDBDatabaseImpl::LevelDBDatabaseImpl(
31 mojo::InterfaceRequest<LevelDBDatabase> request, 31 leveldb::LevelDBDatabaseRequest request,
32 scoped_ptr<MojoEnv> environment, 32 scoped_ptr<MojoEnv> environment,
33 scoped_ptr<leveldb::DB> db) 33 scoped_ptr<leveldb::DB> db)
34 : binding_(this, std::move(request)), 34 : binding_(this, std::move(request)),
35 environment_(std::move(environment)), 35 environment_(std::move(environment)),
36 db_(std::move(db)) {} 36 db_(std::move(db)) {}
37 37
38 LevelDBDatabaseImpl::~LevelDBDatabaseImpl() { 38 LevelDBDatabaseImpl::~LevelDBDatabaseImpl() {
39 for (auto& p : iterator_map_) 39 for (auto& p : iterator_map_)
40 delete p.second; 40 delete p.second;
41 for (auto& p : snapshot_map_) 41 for (auto& p : snapshot_map_)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 callback.Run(DatabaseError::INVALID_ARGUMENT, mojo::Array<uint8_t>()); 111 callback.Run(DatabaseError::INVALID_ARGUMENT, mojo::Array<uint8_t>());
112 112
113 std::string value; 113 std::string value;
114 leveldb::ReadOptions options; 114 leveldb::ReadOptions options;
115 options.snapshot = it->second; 115 options.snapshot = it->second;
116 leveldb::Status status = db_->Get(options, GetSliceFor(key), &value); 116 leveldb::Status status = db_->Get(options, GetSliceFor(key), &value);
117 callback.Run(LeveldbStatusToError(status), mojo::Array<uint8_t>::From(value)); 117 callback.Run(LeveldbStatusToError(status), mojo::Array<uint8_t>::From(value));
118 } 118 }
119 119
120 } // namespace leveldb 120 } // namespace leveldb
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698