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

Side by Side Diff: components/leveldb/public/cpp/util.h

Issue 2285623002: [Leveldb] Use std::{string,vector} instead of mojo::{String,Array}. (Closed)
Patch Set: Address comments from Yuzhu Created 4 years, 3 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 | « components/leveldb/public/cpp/remote_iterator.cc ('k') | components/leveldb/public/cpp/util.cc » ('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 #ifndef COMPONENTS_LEVELDB_PUBLIC_CPP_UTIL_H_ 5 #ifndef COMPONENTS_LEVELDB_PUBLIC_CPP_UTIL_H_
6 #define COMPONENTS_LEVELDB_PUBLIC_CPP_UTIL_H_ 6 #define COMPONENTS_LEVELDB_PUBLIC_CPP_UTIL_H_
7 7
8 #include "components/leveldb/public/interfaces/leveldb.mojom.h" 8 #include "components/leveldb/public/interfaces/leveldb.mojom.h"
9 9
10 namespace leveldb { 10 namespace leveldb {
11 11
12 class Slice; 12 class Slice;
13 class Status; 13 class Status;
14 14
15 // Builds a mojo mojom::DatabaseError from a leveldb::Status object. 15 // Builds a mojo mojom::DatabaseError from a leveldb::Status object.
16 mojom::DatabaseError LeveldbStatusToError(const leveldb::Status& s); 16 mojom::DatabaseError LeveldbStatusToError(const leveldb::Status& s);
17 17
18 // Creates a leveldb Status object form a database error and two optional 18 // Creates a leveldb Status object form a database error and two optional
19 // messages. A mojoification of the various static leveldb::Status 19 // messages. A mojoification of the various static leveldb::Status
20 // constructors. 20 // constructors.
21 leveldb::Status DatabaseErrorToStatus(mojom::DatabaseError e, 21 leveldb::Status DatabaseErrorToStatus(mojom::DatabaseError e,
22 const Slice& msg, 22 const Slice& msg,
23 const Slice& msg2); 23 const Slice& msg2);
24 24
25 // Builds a Slice pointing to the data inside |a|. This is not a type-converter 25 // Builds a Slice pointing to the data inside |a|. This is not a type-converter
26 // as it is not a copy operation; the returned Slice points into |a| and must 26 // as it is not a copy operation; the returned Slice points into |a| and must
27 // outlive |a|. 27 // outlive |a|.
28 leveldb::Slice GetSliceFor(const mojo::Array<uint8_t>& a); 28 leveldb::Slice GetSliceFor(const std::vector<uint8_t>& a);
29 29
30 // Copies the data that |s| points to into a mojo::Array. 30 // Copies the data that |s| points to into a std::vector.
31 mojo::Array<uint8_t> GetArrayFor(const leveldb::Slice& s); 31 std::vector<uint8_t> GetVectorFor(const leveldb::Slice& s);
32
33 std::string Uint8VectorToStdString(const std::vector<uint8_t>& input);
34
35 std::vector<uint8_t> StdStringToUint8Vector(const std::string& input);
32 36
33 } // namespace leveldb 37 } // namespace leveldb
34 38
35 #endif // COMPONENTS_LEVELDB_PUBLIC_CPP_UTIL_H_ 39 #endif // COMPONENTS_LEVELDB_PUBLIC_CPP_UTIL_H_
OLDNEW
« no previous file with comments | « components/leveldb/public/cpp/remote_iterator.cc ('k') | components/leveldb/public/cpp/util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698