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

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

Issue 226263002: Mojo: Move mojo/public/bindings to mojo/public/tools/bindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 8 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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698