1 | // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 | // for details. All rights reserved. Use of this source code is governed by a |
3 | // BSD-style license that can be found in the LICENSE file. |
4 | |
5 | #ifndef RUNTIME_PLATFORM_ALLOCATION_H_ |
6 | #define RUNTIME_PLATFORM_ALLOCATION_H_ |
7 | |
8 | #include "platform/assert.h" |
9 | |
10 | namespace dart { |
11 | |
12 | // Stack allocated objects subclass from this base class. Objects of this type |
13 | // cannot be allocated on either the C or object heaps. Destructors for objects |
14 | // of this type will not be run unless the stack is unwound through normal |
15 | // program control flow. |
16 | class ValueObject { |
17 | public: |
18 | ValueObject() {} |
19 | ~ValueObject() {} |
20 | |
21 | private: |
22 | DISALLOW_ALLOCATION(); |
23 | DISALLOW_COPY_AND_ASSIGN(ValueObject); |
24 | }; |
25 | |
26 | // Static allocated classes only contain static members and can never |
27 | // be instantiated in the heap or on the stack. |
28 | class AllStatic { |
29 | private: |
30 | DISALLOW_ALLOCATION(); |
31 | DISALLOW_IMPLICIT_CONSTRUCTORS(AllStatic); |
32 | }; |
33 | |
34 | } // namespace dart |
35 | |
36 | #endif // RUNTIME_PLATFORM_ALLOCATION_H_ |
37 | |