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

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl

Issue 1955123003: Mojo C++ bindings: switch the remaining callsites of the old serialization interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@24_union_and_others
Patch Set: Created 4 years, 7 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
OLDNEW
1 {% from "enum_macros.tmpl" import enum_decl -%} 1 {% from "enum_macros.tmpl" import enum_decl -%}
2 2
3 class {{struct.name}} { 3 class {{struct.name}} {
4 public: 4 public:
5 using Data_ = internal::{{struct.name}}_Data; 5 using Data_ = internal::{{struct.name}}_Data;
6 using Reader = {{struct.name}}_Reader; 6 using Reader = {{struct.name}}_Reader;
7 7
8 {#--- Enums #} 8 {#--- Enums #}
9 {%- for enum in struct.enums -%} 9 {%- for enum in struct.enums -%}
10 {{enum_decl(enum)|indent(2)}} 10 {{enum_decl(enum)|indent(2)}}
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 {#--- Struct members #} 54 {#--- Struct members #}
55 {% for field in struct.fields %} 55 {% for field in struct.fields %}
56 {%- set type = field.kind|cpp_wrapper_type %} 56 {%- set type = field.kind|cpp_wrapper_type %}
57 {%- set name = field.name %} 57 {%- set name = field.name %}
58 {{type}} {{name}}; 58 {{type}} {{name}};
59 {%- endfor %} 59 {%- endfor %}
60 }; 60 };
61 61
62 {# TODO(yzshen): Remove these wrappers of the Serializer interface. #}
63 size_t GetSerializedSize_({{struct.name}}Ptr& input,
64 mojo::internal::SerializationContext* context);
65 void Serialize_({{struct.name}}Ptr input, mojo::internal::Buffer* buffer,
66 internal::{{struct.name}}_Data** output,
67 mojo::internal::SerializationContext* context);
68 bool Deserialize_(internal::{{struct.name}}_Data* input,
69 {{struct.name}}Ptr* output,
70 mojo::internal::SerializationContext* context);
71
72 {# TODO(yzshen): Redo the Reader interface. #} 62 {# TODO(yzshen): Redo the Reader interface. #}
73 {# NOTE: Generated Reader instances are intentionally cheap to copy and devoid 63 {# NOTE: Generated Reader instances are intentionally cheap to copy and devoid
74 of heap allocations. They should stay this way. #} 64 of heap allocations. They should stay this way. #}
75 class {{struct.name}}_Reader { 65 class {{struct.name}}_Reader {
76 public: 66 public:
77 {{struct.name}}_Reader(internal::{{struct.name}}_Data* data, 67 {{struct.name}}_Reader(internal::{{struct.name}}_Data* data,
78 mojo::internal::SerializationContext* context); 68 mojo::internal::SerializationContext* context);
79 69
80 {%- for pf in struct.packed.packed_fields_in_ordinal_order %} 70 {%- for pf in struct.packed.packed_fields_in_ordinal_order %}
81 {%- set kind = pf.field.kind -%} 71 {%- set kind = pf.field.kind -%}
(...skipping 23 matching lines...) Expand all
105 } 95 }
106 {%- else %} 96 {%- else %}
107 {{kind|cpp_result_type}} {{name}}() const { return data_->{{name}}; } 97 {{kind|cpp_result_type}} {{name}}() const { return data_->{{name}}; }
108 {%- endif %} 98 {%- endif %}
109 {%- endfor %} 99 {%- endfor %}
110 100
111 private: 101 private:
112 internal::{{struct.name}}_Data* data_; 102 internal::{{struct.name}}_Data* data_;
113 mojo::internal::SerializationContext* context_; 103 mojo::internal::SerializationContext* context_;
114 }; 104 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698