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