| 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 LocalHandle; | 14 class LocalHandle; |
| 15 class PersistentHandle; | 15 class PersistentHandle; |
| 16 class WeakPersistentHandle; |
| 16 | 17 |
| 17 const char* CanonicalFunction(const char* func); | 18 const char* CanonicalFunction(const char* func); |
| 18 | 19 |
| 19 #define CURRENT_FUNC CanonicalFunction(__FUNCTION__) | 20 #define CURRENT_FUNC CanonicalFunction(__FUNCTION__) |
| 20 | 21 |
| 21 // Checks that the current isolate is not NULL. | 22 // Checks that the current isolate is not NULL. |
| 22 #define CHECK_ISOLATE(isolate) \ | 23 #define CHECK_ISOLATE(isolate) \ |
| 23 do { \ | 24 do { \ |
| 24 if ((isolate) == NULL) { \ | 25 if ((isolate) == NULL) { \ |
| 25 FATAL1("%s expects there to be a current isolate. Did you " \ | 26 FATAL1("%s expects there to be a current isolate. Did you " \ |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 #undef DECLARE_UNWRAP | 86 #undef DECLARE_UNWRAP |
| 86 | 87 |
| 87 // Validates and converts the passed in handle as a local handle. | 88 // Validates and converts the passed in handle as a local handle. |
| 88 static LocalHandle* UnwrapAsLocalHandle(const ApiState& state, | 89 static LocalHandle* UnwrapAsLocalHandle(const ApiState& state, |
| 89 Dart_Handle object); | 90 Dart_Handle object); |
| 90 | 91 |
| 91 // Validates and converts the passed in handle as a persistent handle. | 92 // Validates and converts the passed in handle as a persistent handle. |
| 92 static PersistentHandle* UnwrapAsPersistentHandle(const ApiState& state, | 93 static PersistentHandle* UnwrapAsPersistentHandle(const ApiState& state, |
| 93 Dart_Handle object); | 94 Dart_Handle object); |
| 94 | 95 |
| 96 // Validates and converts the passed in handle as a weak persistent handle. |
| 97 static WeakPersistentHandle* UnwrapAsWeakPersistentHandle( |
| 98 const ApiState& state, |
| 99 Dart_Handle object); |
| 100 |
| 95 // Casts the internal Isolate* type to the external Dart_Isolate type. | 101 // Casts the internal Isolate* type to the external Dart_Isolate type. |
| 96 static Dart_Isolate CastIsolate(Isolate* isolate); | 102 static Dart_Isolate CastIsolate(Isolate* isolate); |
| 97 | 103 |
| 98 // Casts a message byte array to the external Dart_Message type. | 104 // Casts a message byte array to the external Dart_Message type. |
| 99 static Dart_Message CastMessage(uint8_t* message); | 105 static Dart_Message CastMessage(uint8_t* message); |
| 100 | 106 |
| 101 // Gets the handle used to designate successful return. | 107 // Gets the handle used to designate successful return. |
| 102 static Dart_Handle Success(); | 108 static Dart_Handle Success(); |
| 103 | 109 |
| 104 // Generates a handle used to designate an error return. | 110 // Generates a handle used to designate an error return. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 116 // Allocates space in the local zone. | 122 // Allocates space in the local zone. |
| 117 static uword Allocate(intptr_t size); | 123 static uword Allocate(intptr_t size); |
| 118 | 124 |
| 119 // Reallocates space in the local zone. | 125 // Reallocates space in the local zone. |
| 120 static uword Reallocate(uword ptr, intptr_t old_size, intptr_t new_size); | 126 static uword Reallocate(uword ptr, intptr_t old_size, intptr_t new_size); |
| 121 }; | 127 }; |
| 122 | 128 |
| 123 } // namespace dart. | 129 } // namespace dart. |
| 124 | 130 |
| 125 #endif // VM_DART_API_IMPL_H_ | 131 #endif // VM_DART_API_IMPL_H_ |
| OLD | NEW |