1 // Copyright 2013 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.
5 #include "mojo/common/common_type_converters.h"
10 String TypeConverter
<String
, base::StringPiece
>::ConvertFrom(
11 const base::StringPiece
& input
,
13 String::Builder
result(input
.size(), buf
);
14 memcpy(&result
[0], input
.data(), input
.size());
15 return result
.Finish();
18 base::StringPiece TypeConverter
<String
, base::StringPiece
>::ConvertTo(
19 const String
& input
) {
20 return input
.is_null() ? base::StringPiece() :
21 base::StringPiece(&input
[0], input
.size());