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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/union_traits_definition.tmpl

Issue 2259283003: Mojo C++ bindings: share DataView class between chromium and blink variants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@92_change_traits_param
Patch Set: . Created 4 years, 4 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/union_traits_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/union_traits_definition.tmpl
similarity index 81%
rename from mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl
rename to mojo/public/tools/bindings/generators/cpp_templates/union_traits_definition.tmpl
index 5394950b2dc5c8989e04f7fe24dbc79fc63cc155..cde3f95669369fad483f82f05dd8142acc45fef1 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/union_serialization_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/union_traits_definition.tmpl
@@ -19,10 +19,15 @@ bool UnionTraits<{{mojom_type}}::DataView, {{mojom_type}}Ptr>::Read(
if (!input.Read{{name|under_to_camel}}(result_acc.data()->{{name}}))
return false;
-{%- elif kind|is_any_handle_or_interface_kind %}
+{%- elif kind|is_any_handle_kind %}
auto result_{{name}} = input.Take{{name|under_to_camel}}();
result->set_{{name}}(std::move(result_{{name}}));
+{%- elif kind|is_any_interface_kind %}
+ auto result_{{name}} =
+ input.Take{{name|under_to_camel}}<typename std::remove_reference<decltype(result->get_{{name}}())>::type>();
+ result->set_{{name}}(std::move(result_{{name}}));
+
{%- elif kind|is_enum_kind %}
decltype(result->get_{{name}}()) result_{{name}};
if (!input.Read{{name|under_to_camel}}(&result_{{name}}))

Powered by Google App Engine
This is Rietveld 408576698