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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/union_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/union_declaration.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl
index be2db4c952f15f766ad5c1135f83fc2f35616c94..d65854073187bfc6aed181e11d6a8d55407820b5 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/union_declaration.tmpl
@@ -6,7 +6,11 @@ class {{class_name}} {
public:
// Used to identify Mojom Union Data Classes.
typedef void MojomUnionDataType;
- 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}}();
+ }
+
{{class_name}}();
// Do nothing in the destructor since it won't be called.
~{{class_name}}() {}

Powered by Google App Engine
This is Rietveld 408576698