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

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

Issue 294833002: Mojo: more idiomatic C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/cpp_templates/params_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/params_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/params_definition.tmpl
index 28f7f781313148ed29284c24b86109ddf023a6a1..ad9ab1469701b4ed56faabfd67a72b390ede83cc 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/params_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/params_definition.tmpl
@@ -2,23 +2,13 @@
{%- set class_name = struct.name ~ "_Data" %}
class {{class_name}} {
public:
- static {{class_name}}* New(mojo::Buffer* buf) {
+ static {{class_name}}* New(mojo::internal::Buffer* buf) {
return new (buf->Allocate(sizeof({{class_name}})))
{{class_name}}();
}
-{#--- Setters -#}
-{{ struct_macros.setters(struct) }}
-
-{#--- Getters -#}
-{{ struct_macros.getters(struct) }}
-
- void CloseHandles() {
-{%- for pf in struct.packed.packed_fields if pf.field.kind|is_object_kind %}
- if ({{pf.field.name}}_.ptr)
- {{pf.field.name}}_.ptr->CloseHandles();
-{%- endfor %}
- }
+ mojo::internal::StructHeader header_;
+{{struct_macros.fields(struct)}}
void EncodePointersAndHandles(std::vector<mojo::Handle>* handles) {
{{ struct_macros.encodes(struct)|indent(4) }}
@@ -31,12 +21,9 @@ class {{class_name}} {
private:
{{class_name}}() {
- _header_.num_bytes = sizeof(*this);
- _header_.num_fields = {{struct.packed.packed_fields|length}};
+ header_.num_bytes = sizeof(*this);
+ header_.num_fields = {{struct.packed.packed_fields|length}};
}
-
- mojo::internal::StructHeader _header_;
-{{ struct_macros.fields(struct) }}
};
MOJO_COMPILE_ASSERT(sizeof({{class_name}}) == {{struct.packed|struct_size}},
bad_sizeof_{{class_name}});

Powered by Google App Engine
This is Rietveld 408576698