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