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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
index c432eb04f62228aa384a736cd69b0c4e4b8b07e5..e8e92460cd67b41997d02a291f39b2b6df60a53e 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
@@ -3,14 +3,13 @@
{%- set data_type = struct|get_qualified_name_for_kind(internal=True) %}
// static
-bool StructTraits<{{mojom_type}}, {{mojom_type}}Ptr>::ReadFromRawData(
- {{data_type}}* input,
- {{mojom_type}}Ptr* output,
- internal::SerializationContext* context) {
+bool StructTraits<{{mojom_type}}, {{mojom_type}}Ptr>::ReadFromDataView(
+ {{mojom_type}}DataView input,
+ {{mojom_type}}Ptr* output) {
bool success = true;
- if (input) {
+ if (!input.is_null()) {
{{mojom_type}}Ptr result({{mojom_type}}::New());
- {{struct_macros.deserialize(struct, "input", "result->%s", "context",
+ {{struct_macros.deserialize(struct, "input", "result->%s",
"success")|indent(4)}}
*output = std::move(result);
} else {

Powered by Google App Engine
This is Rietveld 408576698