Chromium Code Reviews| Index: mojo/common/common_custom_types_struct_traits.cc |
| diff --git a/mojo/common/common_custom_types_struct_traits.cc b/mojo/common/common_custom_types_struct_traits.cc |
| index 21026d4d78e9ce3d6486d4435d9b74f3057ae05c..fb7b6c601a1e205414c24118e6eac9118128cc2b 100644 |
| --- a/mojo/common/common_custom_types_struct_traits.cc |
| +++ b/mojo/common/common_custom_types_struct_traits.cc |
| @@ -9,6 +9,25 @@ |
| namespace mojo { |
| // static |
| +std::vector<uint16_t> |
| +StructTraits<mojo::common::mojom::String16DataView, base::string16>::data( |
| + const base::string16& str) { |
| + return std::vector<uint16_t>(str.data(), str.data() + str.size()); |
|
Ken Rockot(use gerrit already)
2016/10/04 18:20:28
Another reason to add mojo::ConstCArray (see other
Zhiqiang Zhang (Slow)
2016/10/04 20:06:22
Done.
|
| +} |
| + |
| +// static |
| +bool StructTraits<mojo::common::mojom::String16DataView, base::string16>::Read( |
| + mojo::common::mojom::String16DataView data, |
| + base::string16* out) { |
| + mojo::ArrayDataView<uint16_t> view; |
| + data.GetDataDataView(&view); |
| + if (view.is_null()) |
| + return false; |
| + out->assign(reinterpret_cast<const base::char16*>(view.data()), view.size()); |
| + return true; |
| +} |
| + |
| +// static |
| const std::vector<uint32_t>& |
| StructTraits<mojo::common::mojom::VersionDataView, base::Version>::components( |
| const base::Version& version) { |