| OLD | NEW |
| (Empty) |
| 1 // Copyright $year The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef $header_guard | |
| 6 #define $header_guard | |
| 7 | |
| 8 #include "mojo/public/bindings/lib/bindings.h" | |
| 9 | |
| 10 namespace $namespace { | |
| 11 | |
| 12 #pragma pack(push, 1) | |
| 13 | |
| 14 class $classname { | |
| 15 public: | |
| 16 static $classname* New(mojo::Buffer* buf) { | |
| 17 return new (buf->Allocate(sizeof($classname))) $classname(); | |
| 18 } | |
| 19 | |
| 20 $setters | |
| 21 | |
| 22 $getters | |
| 23 | |
| 24 private: | |
| 25 friend class mojo::internal::ObjectTraits<$classname>; | |
| 26 | |
| 27 $classname() { | |
| 28 header_.num_bytes = sizeof(*this); | |
| 29 header_.num_fields = $num_fields; | |
| 30 } | |
| 31 ~$classname(); // NOT IMPLEMENTED | |
| 32 | |
| 33 mojo::internal::StructHeader _header_; | |
| 34 $fields | |
| 35 }; | |
| 36 | |
| 37 MOJO_COMPILE_ASSERT(sizeof($classname) == $size, bad_sizeof_$classname); | |
| 38 | |
| 39 #pragma pack(pop) | |
| 40 | |
| 41 } // namespace $namespace | |
| 42 | |
| 43 #endif // $header_guard | |
| OLD | NEW |