OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 VM_DART_API_IMPL_H_ | 5 #ifndef VM_DART_API_IMPL_H_ |
6 #define VM_DART_API_IMPL_H_ | 6 #define VM_DART_API_IMPL_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 class ApiState; | 13 class ApiState; |
| 14 class FinalizablePersistentHandle; |
14 class LocalHandle; | 15 class LocalHandle; |
15 class PersistentHandle; | 16 class PersistentHandle; |
16 class WeakPersistentHandle; | |
17 | 17 |
18 const char* CanonicalFunction(const char* func); | 18 const char* CanonicalFunction(const char* func); |
19 | 19 |
20 #define CURRENT_FUNC CanonicalFunction(__FUNCTION__) | 20 #define CURRENT_FUNC CanonicalFunction(__FUNCTION__) |
21 | 21 |
22 // Checks that the current isolate is not NULL. | 22 // Checks that the current isolate is not NULL. |
23 #define CHECK_ISOLATE(isolate) \ | 23 #define CHECK_ISOLATE(isolate) \ |
24 do { \ | 24 do { \ |
25 if ((isolate) == NULL) { \ | 25 if ((isolate) == NULL) { \ |
26 FATAL1("%s expects there to be a current isolate. Did you " \ | 26 FATAL1("%s expects there to be a current isolate. Did you " \ |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // Validates and converts the passed in handle as a local handle. | 88 // Validates and converts the passed in handle as a local handle. |
89 static LocalHandle* UnwrapAsLocalHandle(const ApiState& state, | 89 static LocalHandle* UnwrapAsLocalHandle(const ApiState& state, |
90 Dart_Handle object); | 90 Dart_Handle object); |
91 | 91 |
92 // Validates and converts the passed in handle as a persistent handle. | 92 // Validates and converts the passed in handle as a persistent handle. |
93 static PersistentHandle* UnwrapAsPersistentHandle(const ApiState& state, | 93 static PersistentHandle* UnwrapAsPersistentHandle(const ApiState& state, |
94 Dart_Handle object); | 94 Dart_Handle object); |
95 | 95 |
96 // Validates and converts the passed in handle as a weak persistent handle. | 96 // Validates and converts the passed in handle as a weak persistent handle. |
97 static WeakPersistentHandle* UnwrapAsWeakPersistentHandle( | 97 static FinalizablePersistentHandle* UnwrapAsWeakPersistentHandle( |
98 const ApiState& state, | 98 const ApiState& state, |
99 Dart_Handle object); | 99 Dart_Handle object); |
100 | 100 |
| 101 // Validates and converts the passed in handle as a prologue weak |
| 102 // persistent handle. |
| 103 static FinalizablePersistentHandle* UnwrapAsPrologueWeakPersistentHandle( |
| 104 const ApiState& state, |
| 105 Dart_Handle object); |
| 106 |
101 // Casts the internal Isolate* type to the external Dart_Isolate type. | 107 // Casts the internal Isolate* type to the external Dart_Isolate type. |
102 static Dart_Isolate CastIsolate(Isolate* isolate); | 108 static Dart_Isolate CastIsolate(Isolate* isolate); |
103 | 109 |
104 // Gets the handle used to designate successful return. | 110 // Gets the handle used to designate successful return. |
105 static Dart_Handle Success(); | 111 static Dart_Handle Success(); |
106 | 112 |
107 // Generates a handle used to designate an error return. | 113 // Generates a handle used to designate an error return. |
108 static Dart_Handle NewError(const char* format, ...); | 114 static Dart_Handle NewError(const char* format, ...); |
109 | 115 |
110 // Gets a handle to Null. | 116 // Gets a handle to Null. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 149 } |
144 private: | 150 private: |
145 Isolate* saved_isolate_; | 151 Isolate* saved_isolate_; |
146 | 152 |
147 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); | 153 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); |
148 }; | 154 }; |
149 | 155 |
150 } // namespace dart. | 156 } // namespace dart. |
151 | 157 |
152 #endif // VM_DART_API_IMPL_H_ | 158 #endif // VM_DART_API_IMPL_H_ |
OLD | NEW |