| OLD | NEW |
| 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 // static | 3 // static |
| 4 {{class_name}}* {{class_name}}::New(mojo::Buffer* buf, mojo::Buffer::Destructor
dtor) { | 4 {{class_name}}* {{class_name}}::New(mojo::Buffer* buf, mojo::Buffer::Destructor
dtor) { |
| 5 return new (buf->Allocate(sizeof({{class_name}}), dtor)) {{class_name}}(); | 5 return new (buf->Allocate(sizeof({{class_name}}), dtor)) {{class_name}}(); |
| 6 } | 6 } |
| 7 | 7 |
| 8 {{class_name}}::{{class_name}}() { | 8 {{class_name}}::{{class_name}}() { |
| 9 _header_.num_bytes = sizeof(*this); | 9 _header_.num_bytes = sizeof(*this); |
| 10 _header_.num_fields = {{struct.packed.packed_fields|length}}; | 10 _header_.num_fields = {{struct.packed.packed_fields|length}}; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 void {{class_name}}::EncodePointersAndHandles( | 45 void {{class_name}}::EncodePointersAndHandles( |
| 46 std::vector<mojo::Handle>* handles) { | 46 std::vector<mojo::Handle>* handles) { |
| 47 {{ struct_macros.encodes(struct)|indent(2) }} | 47 {{ struct_macros.encodes(struct)|indent(2) }} |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool {{class_name}}::DecodePointersAndHandles(mojo::Message* message) { | 50 bool {{class_name}}::DecodePointersAndHandles(mojo::Message* message) { |
| 51 {{ struct_macros.decodes(struct)|indent(2) }} | 51 {{ struct_macros.decodes(struct)|indent(2) }} |
| 52 return true; | 52 return true; |
| 53 } | 53 } |
| OLD | NEW |