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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl
index dd87be74bf4e467c380759da7d82c5c6674a124f..28d63997b9d51ca1dc09cb840bed7c42a9c860be 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl
@@ -2,7 +2,9 @@
class {{class_name}} {
public:
- static {{class_name}}* New(mojo::internal::Buffer* buf);
+ static {{class_name}}* New(mojo::internal::Buffer* buf) {
+ return new (buf->Allocate(sizeof({{class_name}}))) {{class_name}}();
+ }
static bool Validate(const void* data,
mojo::internal::ValidationContext* validation_context);
« 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