OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "third_party/mojo/src/mojo/public/cpp/bindings/lib/string_serialization
.h" | 5 #include "mojo/public/cpp/bindings/lib/string_serialization.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 | 10 |
11 size_t GetSerializedSize_(const String& input) { | 11 size_t GetSerializedSize_(const String& input) { |
12 if (!input) | 12 if (!input) |
13 return 0; | 13 return 0; |
14 return internal::Align(sizeof(internal::String_Data) + input.size()); | 14 return internal::Align(sizeof(internal::String_Data) + input.size()); |
15 } | 15 } |
(...skipping 15 matching lines...) Expand all Loading... |
31 void Deserialize_(internal::String_Data* input, String* output) { | 31 void Deserialize_(internal::String_Data* input, String* output) { |
32 if (input) { | 32 if (input) { |
33 String result(input->storage(), input->size()); | 33 String result(input->storage(), input->size()); |
34 result.Swap(output); | 34 result.Swap(output); |
35 } else { | 35 } else { |
36 output->reset(); | 36 output->reset(); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 } // namespace mojo | 40 } // namespace mojo |
OLD | NEW |