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) %} | |
4 | 3 |
5 // static | 4 // static |
6 bool StructTraits<{{mojom_type}}, {{mojom_type}}Ptr>::ReadFromDataView( | 5 bool StructTraits<{{mojom_type}}, {{mojom_type}}Ptr>::Read( |
7 {{mojom_type}}DataView input, | 6 {{mojom_type}}DataView input, |
8 {{mojom_type}}Ptr* output) { | 7 {{mojom_type}}Ptr* output) { |
9 bool success = true; | 8 bool success = true; |
10 if (!input.is_null()) { | 9 {{mojom_type}}Ptr result({{mojom_type}}::New()); |
11 {{mojom_type}}Ptr result({{mojom_type}}::New()); | 10 {{struct_macros.deserialize(struct, "input", "result->%s", |
12 {{struct_macros.deserialize(struct, "input", "result->%s", | 11 "success")|indent(4)}} |
13 "success")|indent(4)}} | 12 *output = std::move(result); |
14 *output = std::move(result); | |
15 } else { | |
16 output->reset(); | |
17 } | |
18 return success; | 13 return success; |
19 } | 14 } |
OLD | NEW |