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

Unified Diff: mojo/public/bindings/generators/cpp_templates/params_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
Index: mojo/public/bindings/generators/cpp_templates/params_definition.tmpl
diff --git a/mojo/public/bindings/generators/cpp_templates/params_definition.tmpl b/mojo/public/bindings/generators/cpp_templates/params_definition.tmpl
index 32d9bab950668635b6465987cc8b0f59071e1579..b21f537dd4b3f3efddf009ec01329e116931a374 100644
--- a/mojo/public/bindings/generators/cpp_templates/params_definition.tmpl
+++ b/mojo/public/bindings/generators/cpp_templates/params_definition.tmpl
@@ -15,9 +15,23 @@ class {{class_name}} {
{#--- Getters -#}
{{ struct_macros.getters(struct) }}
- private:
- friend class mojo::internal::ObjectTraits<{{class_name}}>;
+ void CloseHandles() {
+{%- for pf in struct.packed.packed_fields if pf.field.kind|is_object_kind %}
+ if ({{pf.field.name}}_.ptr)
+ {{pf.field.name}}_.ptr->CloseHandles();
+{%- endfor %}
+ }
+
+ void EncodePointersAndHandles(std::vector<mojo::Handle>* handles) {
+ {{ struct_macros.encodes(struct)|indent(4) }}
+ }
+ bool DecodePointersAndHandles(mojo::Message* message) {
+ {{ struct_macros.decodes(struct)|indent(4) }}
+ return true;
+ }
+
+ private:
{{class_name}}() {
_header_.num_bytes = sizeof(*this);
_header_.num_fields = 3;

Powered by Google App Engine
This is Rietveld 408576698