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

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

Issue 2207763003: Make mojo::internal::Buffer a non-virtual class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@85_3_inline_validation_context
Patch Set: Created 4 years, 4 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
OLDNEW
1 {%- set class_name = struct.name ~ "_Data" -%} 1 {%- set class_name = struct.name ~ "_Data" -%}
2 2
3 class {{class_name}} { 3 class {{class_name}} {
4 public: 4 public:
5 static {{class_name}}* New(mojo::internal::Buffer* buf); 5 static {{class_name}}* New(mojo::internal::Buffer* buf) {
6 return new (buf->Allocate(sizeof({{class_name}}))) {{class_name}}();
7 }
6 8
7 static bool Validate(const void* data, 9 static bool Validate(const void* data,
8 mojo::internal::ValidationContext* validation_context); 10 mojo::internal::ValidationContext* validation_context);
9 11
10 {% from "enum_macros.tmpl" import enum_data_decl -%} 12 {% from "enum_macros.tmpl" import enum_data_decl -%}
11 {#--- Enums #} 13 {#--- Enums #}
12 {%- for enum in struct.enums -%} 14 {%- for enum in struct.enums -%}
13 {%- if enum|is_native_only_kind %} 15 {%- if enum|is_native_only_kind %}
14 using {{enum.name}}_Data = mojo::internal::NativeEnum_Data; 16 using {{enum.name}}_Data = mojo::internal::NativeEnum_Data;
15 {%- else %} 17 {%- else %}
(...skipping 28 matching lines...) Expand all
44 uint8_t padfinal_[{{pad}}]; 46 uint8_t padfinal_[{{pad}}];
45 {%- endif %} 47 {%- endif %}
46 {%- endif %} 48 {%- endif %}
47 49
48 private: 50 private:
49 {{class_name}}(); 51 {{class_name}}();
50 ~{{class_name}}() = delete; 52 ~{{class_name}}() = delete;
51 }; 53 };
52 static_assert(sizeof({{class_name}}) == {{struct.versions[-1].num_bytes}}, 54 static_assert(sizeof({{class_name}}) == {{struct.versions[-1].num_bytes}},
53 "Bad sizeof({{class_name}})"); 55 "Bad sizeof({{class_name}})");
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/message.h ('k') | mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698