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

Unified Diff: mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl

Issue 131033002: Mojo: Simplify object serialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indentation error Created 6 years, 11 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
« no previous file with comments | « no previous file | mojo/public/bindings/generators/cpp_templates/module.cc.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl
diff --git a/mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl b/mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl
index 9885a365109ea56d44d5a50e76a48e7984de35c8..713939ae1d0f68ce745b928dfc34b5394d3b7885 100644
--- a/mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl
+++ b/mojo/public/bindings/generators/cpp_templates/interface_definition.tmpl
@@ -23,8 +23,8 @@ void {{proxy_name}}::{{method.name}}({{params_list(method)}}) {
{#--- Computes #}
{%- for param in method.parameters %}
{%- if param.kind|is_object_kind %}
- payload_size += mojo::internal::ComputeSizeOf(
- mojo::internal::Unwrap({{param.name}}));
+ if (!{{param.name}}.is_null())
+ payload_size += mojo::internal::Unwrap({{param.name}})->ComputeSize();
{%- endif %}
{%- endfor %}
@@ -36,9 +36,9 @@ void {{proxy_name}}::{{method.name}}({{params_list(method)}}) {
{#--- Sets #}
{% for param in method.parameters %}
{%- if param.kind|is_object_kind %}
- params->set_{{param.name}}(
- mojo::internal::Clone(mojo::internal::Unwrap({{param.name}}),
- builder.buffer()));
+ if (!{{param.name}}.is_null())
+ params->set_{{param.name}}(
+ mojo::internal::Unwrap({{param.name}})->Clone(builder.buffer()));
{%- elif param.kind|is_handle_kind %}
params->set_{{param.name}}({{param.name}}.release());
{%- else %}
@@ -47,7 +47,7 @@ void {{proxy_name}}::{{method.name}}({{params_list(method)}}) {
{%- endfor %}
mojo::Message message;
- mojo::internal::EncodePointersAndHandles(params, &message.handles);
+ params->EncodePointersAndHandles(&message.handles);
message.data = builder.Finish();
@@ -81,10 +81,10 @@ bool {{class_name}}Stub::Accept(mojo::Message* message) {
reinterpret_cast<internal::{{class_name}}_{{method.name}}_Params_Data*>(
message->data->payload);
- if (!mojo::internal::DecodePointersAndHandles(params, message))
+ if (!params->DecodePointersAndHandles(message))
return false;
sink_->{{method.name}}({{params(method)}});
- mojo::internal::CloseHandles(params);
+ params->CloseHandles();
break;
}
{%- endfor %}
« no previous file with comments | « no previous file | mojo/public/bindings/generators/cpp_templates/module.cc.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698