OLD | NEW |
1 {%- import "struct_macros.tmpl" as struct_macros %} | 1 {%- import "struct_macros.tmpl" as struct_macros %} |
2 {%- set mojom_type = struct|get_qualified_name_for_kind %} | 2 {%- set mojom_type = struct|get_qualified_name_for_kind %} |
3 {%- set data_type = struct|get_qualified_name_for_kind(internal=True) %} | 3 {%- set data_type = struct|get_qualified_name_for_kind(internal=True) %} |
4 | 4 |
5 // static | 5 // static |
6 bool StructTraits<{{mojom_type}}, {{mojom_type}}Ptr>::ReadFromRawData( | 6 bool StructTraits<{{mojom_type}}, {{mojom_type}}Ptr>::ReadFromDataView( |
7 {{data_type}}* input, | 7 {{mojom_type}}DataView input, |
8 {{mojom_type}}Ptr* output, | 8 {{mojom_type}}Ptr* output) { |
9 internal::SerializationContext* context) { | |
10 bool success = true; | 9 bool success = true; |
11 if (input) { | 10 if (!input.is_null()) { |
12 {{mojom_type}}Ptr result({{mojom_type}}::New()); | 11 {{mojom_type}}Ptr result({{mojom_type}}::New()); |
13 {{struct_macros.deserialize(struct, "input", "result->%s", "context", | 12 {{struct_macros.deserialize(struct, "input", "result->%s", |
14 "success")|indent(4)}} | 13 "success")|indent(4)}} |
15 *output = std::move(result); | 14 *output = std::move(result); |
16 } else { | 15 } else { |
17 output->reset(); | 16 output->reset(); |
18 } | 17 } |
19 return success; | 18 return success; |
20 } | 19 } |
OLD | NEW |