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

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

Issue 2064903002: Mojo: Report bindings validation errors via MojoNotifyBadMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 6
7 static bool Validate(const void* data, 7 static bool Validate(const void* data,
8 mojo::internal::BoundsChecker* bounds_checker); 8 mojo::internal::ValidationContext* validation_context);
9 9
10 void EncodePointers(); 10 void EncodePointers();
11 void DecodePointers(); 11 void DecodePointers();
12 12
13 {% from "enum_macros.tmpl" import enum_data_decl -%} 13 {% from "enum_macros.tmpl" import enum_data_decl -%}
14 {#--- Enums #} 14 {#--- Enums #}
15 {%- for enum in struct.enums -%} 15 {%- for enum in struct.enums -%}
16 {%- if enum|is_native_only_kind %} 16 {%- if enum|is_native_only_kind %}
17 using {{enum.name}}_Data = mojo::internal::NativeEnum_Data; 17 using {{enum.name}}_Data = mojo::internal::NativeEnum_Data;
18 {%- else %} 18 {%- else %}
(...skipping 28 matching lines...) Expand all
47 uint8_t padfinal_[{{pad}}]; 47 uint8_t padfinal_[{{pad}}];
48 {%- endif %} 48 {%- endif %}
49 {%- endif %} 49 {%- endif %}
50 50
51 private: 51 private:
52 {{class_name}}(); 52 {{class_name}}();
53 ~{{class_name}}() = delete; 53 ~{{class_name}}() = delete;
54 }; 54 };
55 static_assert(sizeof({{class_name}}) == {{struct.versions[-1].num_bytes}}, 55 static_assert(sizeof({{class_name}}) == {{struct.versions[-1].num_bytes}},
56 "Bad sizeof({{class_name}})"); 56 "Bad sizeof({{class_name}})");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698