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

Side by Side Diff: mojo/public/bindings/generators/cpp_templates/struct_declaration.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
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 typedef {{struct.name}} Wrapper; 5 typedef {{struct.name}} Wrapper;
6 6
7 {#--- Enums #} 7 {#--- Enums #}
8 {%- for enum in struct.enums %} 8 {%- for enum in struct.enums %}
9 {% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %} 9 {% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %}
10 {{enum_def()|indent(2)}} 10 {{enum_def()|indent(2)}}
11 {%- endfor %} 11 {%- endfor %}
12 12
13 static {{class_name}}* New(mojo::Buffer* buf, mojo::Buffer::Destructor dtor = NULL); 13 static {{class_name}}* New(mojo::Buffer* buf, mojo::Buffer::Destructor dtor = NULL);
14 14
15 {#--- Setters -#} 15 {#--- Setters -#}
16 {{ struct_macros.setters(struct) }} 16 {{ struct_macros.setters(struct) }}
17 17
18 {#--- Getters -#} 18 {#--- Getters -#}
19 {{ struct_macros.getters(struct) }} 19 {{ struct_macros.getters(struct) }}
20 20
21 size_t ComputeSize() const;
22 {{class_name}}* Clone(mojo::Buffer* buf) const;
23 void CloseHandles();
24 void EncodePointersAndHandles(std::vector<mojo::Handle>* handles);
25 bool DecodePointersAndHandles(mojo::Message* message);
26
21 private: 27 private:
22 friend class mojo::internal::ObjectTraits<{{class_name}}>;
23
24 {{class_name}}(); 28 {{class_name}}();
25 ~{{class_name}}(); // NOT IMPLEMENTED 29 ~{{class_name}}(); // NOT IMPLEMENTED
26 30
27 mojo::internal::StructHeader _header_; 31 mojo::internal::StructHeader _header_;
28 {{ struct_macros.fields(struct) }} 32 {{ struct_macros.fields(struct) }}
29 }; 33 };
30 MOJO_COMPILE_ASSERT(sizeof({{class_name}}) == {{struct.packed|struct_size}}, 34 MOJO_COMPILE_ASSERT(sizeof({{class_name}}) == {{struct.packed|struct_size}},
31 bad_sizeof_{{class_name}}); 35 bad_sizeof_{{class_name}});
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698