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

Side by Side Diff: mojo/public/bindings/generators/cpp_templates/params_serialization.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 {%- import "struct_macros.tmpl" as struct_macros %}
2 {%- set class_name = "%s::internal::%s_Data"|format(namespace, struct.name) %}
3 {%- set param_name = "params" %}
4 template <>
5 class ObjectTraits<{{class_name}}> {
6 public:
7 static void CloseHandles({{class_name}}* {{param_name}}) {
8 {%- for pf in struct.packed.packed_fields if pf.field.kind|is_object_kind %}
9 mojo::internal::CloseHandles({{param_name}}->{{pf.field.name}}_.ptr);
10 {%- endfor %}
11 }
12
13 static void EncodePointersAndHandles(
14 {{class_name}}* {{param_name}},
15 std::vector<Handle>* handles) {
16 {{ struct_macros.encodes(struct, param_name)|indent(4) }}
17 }
18
19 static bool DecodePointersAndHandles(
20 {{class_name}}* {{param_name}},
21 Message* message) {
22 {{ struct_macros.decodes(struct, param_name)|indent(4) }}
23 return true;
24 }
25 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698