Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl

Issue 1968623002: Mojo C++ bindings: expose public <struct>DataView and StringDataView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@25_totally_new
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698