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

Unified Diff: mojo/public/bindings/generators/cpp_templates/struct_serialization_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/struct_serialization_definition.tmpl
diff --git a/mojo/public/bindings/generators/cpp_templates/struct_serialization_definition.tmpl b/mojo/public/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
deleted file mode 100644
index faed8f5b973a2e32a0ffd3de3c9768c0da28a646..0000000000000000000000000000000000000000
--- a/mojo/public/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
+++ /dev/null
@@ -1,51 +0,0 @@
-{%- import "struct_macros.tmpl" as struct_macros %}
-{%- set class_name = "%s::internal::%s_Data"|format(namespace, struct.name) -%}
-{%- set param_name = struct.name|camel_to_underscores %}
-
-// static
-size_t ObjectTraits<{{class_name}}>::ComputeSizeOf(
- const {{class_name}}* {{param_name}}) {
- return sizeof(*{{param_name}})
-{%- for pf in struct.packed.packed_fields if pf.field.kind|is_object_kind %} +
- mojo::internal::ComputeSizeOf({{param_name}}->{{pf.field.name}}())
-{%- endfor %};
-}
-
-// static
-{{class_name}}* ObjectTraits<{{class_name}}>::Clone(
- const {{class_name}}* {{param_name}}, Buffer* buf) {
- {{class_name}}* clone = {{class_name}}::New(buf);
- memcpy(clone, {{param_name}}, sizeof(*{{param_name}}));
-{%- for pf in struct.packed.packed_fields if pf.field.kind|is_object_kind %}
- clone->set_{{pf.field.name}}(mojo::internal::Clone({#
- #}{{param_name}}->{{pf.field.name}}(), buf));
-{%- endfor %}
-{%- for pf in struct.packed.packed_fields if pf.field.kind|is_handle_kind %}
- mojo::internal::ResetIfNonNull({{param_name}}->{{pf.field.name}}());
-{%- endfor %}
- return clone;
-}
-
-// static
-void ObjectTraits<{{class_name}}>::CloseHandles(
- {{class_name}}* {{param_name}}) {
-{%- for pf in struct.packed.packed_fields if pf.field.kind|is_object_kind %}
- mojo::internal::CloseHandles({{param_name}}->{{pf.field.name}}_.ptr);
-{%- endfor %}
-{%- if struct|is_struct_with_handles %}
- {{struct.name}}_Data_Destructor({{param_name}});
-{%- endif %}
-}
-
-// static
-void ObjectTraits<{{class_name}}>::EncodePointersAndHandles(
- {{class_name}}* {{param_name}}, std::vector<mojo::Handle>* handles) {
- {{ struct_macros.encodes(struct, param_name)|indent(2) }}
-}
-
-// static
-bool ObjectTraits<{{class_name}}>::DecodePointersAndHandles(
- {{class_name}}* {{param_name}}, mojo::Message* message) {
- {{ struct_macros.decodes(struct, param_name)|indent(2) }}
- return true;
-}

Powered by Google App Engine
This is Rietveld 408576698