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

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

Issue 291773002: Mojo cpp bindings: fix |num_fields| in struct header of *Params_Data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {%- import "struct_macros.tmpl" as struct_macros %} 1 {%- import "struct_macros.tmpl" as struct_macros %}
2 {%- set class_name = struct.name ~ "_Data" %} 2 {%- set class_name = struct.name ~ "_Data" %}
3 class {{class_name}} { 3 class {{class_name}} {
4 public: 4 public:
5 static {{class_name}}* New(mojo::Buffer* buf) { 5 static {{class_name}}* New(mojo::Buffer* buf) {
6 return new (buf->Allocate(sizeof({{class_name}}))) 6 return new (buf->Allocate(sizeof({{class_name}})))
7 {{class_name}}(); 7 {{class_name}}();
8 } 8 }
9 9
10 {#--- Setters -#} 10 {#--- Setters -#}
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 bool DecodePointersAndHandles(mojo::Message* message) { 27 bool DecodePointersAndHandles(mojo::Message* message) {
28 {{ struct_macros.decodes(struct)|indent(4) }} 28 {{ struct_macros.decodes(struct)|indent(4) }}
29 return true; 29 return true;
30 } 30 }
31 31
32 private: 32 private:
33 {{class_name}}() { 33 {{class_name}}() {
34 _header_.num_bytes = sizeof(*this); 34 _header_.num_bytes = sizeof(*this);
35 _header_.num_fields = 3; 35 _header_.num_fields = {{struct.packed.packed_fields|length}};
36 } 36 }
37 37
38 mojo::internal::StructHeader _header_; 38 mojo::internal::StructHeader _header_;
39 {{ struct_macros.fields(struct) }} 39 {{ struct_macros.fields(struct) }}
40 }; 40 };
41 MOJO_COMPILE_ASSERT(sizeof({{class_name}}) == {{struct.packed|struct_size}}, 41 MOJO_COMPILE_ASSERT(sizeof({{class_name}}) == {{struct.packed|struct_size}},
42 bad_sizeof_{{class_name}}); 42 bad_sizeof_{{class_name}});
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698