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

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/union_definition.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
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {%- import "validation_macros.tmpl" as validation_macros %} 1 {%- import "validation_macros.tmpl" as validation_macros %}
2 {%- set class_name = union.name ~ "_Data" %} 2 {%- set class_name = union.name ~ "_Data" %}
3 {%- set enum_name = union.name ~ "_Tag" -%} 3 {%- set enum_name = union.name ~ "_Tag" -%}
4 4
5 // static 5 // static
6 {{class_name}}* {{class_name}}::New(mojo::internal::Buffer* buf) {
7 return new (buf->Allocate(sizeof({{class_name}}))) {{class_name}}();
8 }
9
10 // static
11 bool {{class_name}}::Validate( 6 bool {{class_name}}::Validate(
12 const void* data, 7 const void* data,
13 mojo::internal::ValidationContext* validation_context, 8 mojo::internal::ValidationContext* validation_context,
14 bool inlined) { 9 bool inlined) {
15 if (!data) 10 if (!data)
16 return true; 11 return true;
17 12
18 if (!ValidateUnionHeaderAndClaimMemory(data, inlined, validation_context)) 13 if (!ValidateUnionHeaderAndClaimMemory(data, inlined, validation_context))
19 return false; 14 return false;
20 15
(...skipping 20 matching lines...) Expand all
41 36
42 void {{class_name}}::set_null() { 37 void {{class_name}}::set_null() {
43 size = 0U; 38 size = 0U;
44 tag = static_cast<{{enum_name}}>(0); 39 tag = static_cast<{{enum_name}}>(0);
45 data.unknown = 0U; 40 data.unknown = 0U;
46 } 41 }
47 42
48 {{class_name}}::{{class_name}}() { 43 {{class_name}}::{{class_name}}() {
49 } 44 }
50 45
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698