| 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 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 "Dart_EnterScope?", CURRENT_FUNC); \ | 51 "Dart_EnterScope?", CURRENT_FUNC); \ |
| 52 } \ | 52 } \ |
| 53 } while (0) | 53 } while (0) |
| 54 | 54 |
| 55 #define DARTSCOPE(isolate) \ | 55 #define DARTSCOPE(isolate) \ |
| 56 Isolate* __temp_isolate__ = (isolate); \ | 56 Isolate* __temp_isolate__ = (isolate); \ |
| 57 CHECK_ISOLATE_SCOPE(__temp_isolate__); \ | 57 CHECK_ISOLATE_SCOPE(__temp_isolate__); \ |
| 58 HANDLESCOPE(__temp_isolate__); | 58 HANDLESCOPE(__temp_isolate__); |
| 59 | 59 |
| 60 | 60 |
| 61 const char* CheckIsolateState(Isolate *isolate); | |
| 62 | |
| 63 void SetupErrorResult(Dart_Handle* handle); | 61 void SetupErrorResult(Dart_Handle* handle); |
| 64 | 62 |
| 65 | 63 |
| 66 class Api : AllStatic { | 64 class Api : AllStatic { |
| 67 public: | 65 public: |
| 68 // Creates a new local handle. | 66 // Creates a new local handle. |
| 69 static Dart_Handle NewHandle(Isolate* isolate, RawObject* raw); | 67 static Dart_Handle NewHandle(Isolate* isolate, RawObject* raw); |
| 70 | 68 |
| 71 // Unwraps the raw object from the handle. | 69 // Unwraps the raw object from the handle. |
| 72 static RawObject* UnwrapHandle(Dart_Handle object); | 70 static RawObject* UnwrapHandle(Dart_Handle object); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 91 static FinalizablePersistentHandle* UnwrapAsWeakPersistentHandle( | 89 static FinalizablePersistentHandle* UnwrapAsWeakPersistentHandle( |
| 92 const ApiState& state, | 90 const ApiState& state, |
| 93 Dart_Handle object); | 91 Dart_Handle object); |
| 94 | 92 |
| 95 // Validates and converts the passed in handle as a prologue weak | 93 // Validates and converts the passed in handle as a prologue weak |
| 96 // persistent handle. | 94 // persistent handle. |
| 97 static FinalizablePersistentHandle* UnwrapAsPrologueWeakPersistentHandle( | 95 static FinalizablePersistentHandle* UnwrapAsPrologueWeakPersistentHandle( |
| 98 const ApiState& state, | 96 const ApiState& state, |
| 99 Dart_Handle object); | 97 Dart_Handle object); |
| 100 | 98 |
| 99 // Returns an Error handle if isolate is in an inconsistent state. |
| 100 // Returns a Success handle when no error condition exists. |
| 101 static Dart_Handle CheckIsolateState(Isolate *isolate); |
| 102 |
| 101 // Casts the internal Isolate* type to the external Dart_Isolate type. | 103 // Casts the internal Isolate* type to the external Dart_Isolate type. |
| 102 static Dart_Isolate CastIsolate(Isolate* isolate); | 104 static Dart_Isolate CastIsolate(Isolate* isolate); |
| 103 | 105 |
| 104 // Gets the handle used to designate successful return. | 106 // Gets the handle used to designate successful return. |
| 105 static Dart_Handle Success(Isolate* isolate); | 107 static Dart_Handle Success(Isolate* isolate); |
| 106 | 108 |
| 107 // Sets up the callback error object after initializing an Isolate. This | 109 // Sets up the callback error object after initializing an Isolate. This |
| 108 // object is pre-created because we will not be able to allocate this | 110 // object is pre-created because we will not be able to allocate this |
| 109 // object when the error actually occurs. When the error occurs there will | 111 // object when the error actually occurs. When the error occurs there will |
| 110 // be outstanding acquires to internal data pointers making it unsafe to | 112 // be outstanding acquires to internal data pointers making it unsafe to |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 isolate->DecrementNoCallbackScopeDepth() | 191 isolate->DecrementNoCallbackScopeDepth() |
| 190 | 192 |
| 191 #define CHECK_CALLBACK_STATE(isolate) \ | 193 #define CHECK_CALLBACK_STATE(isolate) \ |
| 192 if (isolate->no_callback_scope_depth() != 0) { \ | 194 if (isolate->no_callback_scope_depth() != 0) { \ |
| 193 return reinterpret_cast<Dart_Handle>(Api::CallbackError(isolate)); \ | 195 return reinterpret_cast<Dart_Handle>(Api::CallbackError(isolate)); \ |
| 194 } \ | 196 } \ |
| 195 | 197 |
| 196 } // namespace dart. | 198 } // namespace dart. |
| 197 | 199 |
| 198 #endif // VM_DART_API_IMPL_H_ | 200 #endif // VM_DART_API_IMPL_H_ |
| OLD | NEW |