| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Returns an Error handle if isolate is in an inconsistent state. | 99 // Returns an Error handle if isolate is in an inconsistent state. |
| 100 // Returns a Success handle when no error condition exists. | 100 // Returns a Success handle when no error condition exists. |
| 101 static Dart_Handle CheckIsolateState(Isolate *isolate); | 101 static Dart_Handle CheckIsolateState(Isolate *isolate); |
| 102 | 102 |
| 103 // Casts the internal Isolate* type to the external Dart_Isolate type. | 103 // Casts the internal Isolate* type to the external Dart_Isolate type. |
| 104 static Dart_Isolate CastIsolate(Isolate* isolate); | 104 static Dart_Isolate CastIsolate(Isolate* isolate); |
| 105 | 105 |
| 106 // Gets the handle used to designate successful return. | 106 // Gets the handle used to designate successful return. |
| 107 static Dart_Handle Success(Isolate* isolate); | 107 static Dart_Handle Success(Isolate* isolate); |
| 108 | 108 |
| 109 // Sets up the callback error object after initializing an Isolate. This | 109 // Sets up the acquired error object after initializing an Isolate. This |
| 110 // 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 |
| 111 // 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 |
| 112 // be outstanding acquires to internal data pointers making it unsafe to | 112 // be outstanding acquires to internal data pointers making it unsafe to |
| 113 // allocate objects on the dart heap. | 113 // allocate objects on the dart heap. |
| 114 static void SetupCallbackError(Isolate* isolate); | 114 static void SetupAcquiredError(Isolate* isolate); |
| 115 | 115 |
| 116 // Gets the handle which holds the pre-created callback error object. | 116 // Gets the handle which holds the pre-created acquired error object. |
| 117 static Dart_Handle CallbackError(Isolate* isolate); | 117 static Dart_Handle AcquiredError(Isolate* isolate); |
| 118 | 118 |
| 119 // Returns true if the handle holds a Smi. | 119 // Returns true if the handle holds a Smi. |
| 120 static bool IsSmi(Dart_Handle handle) { | 120 static bool IsSmi(Dart_Handle handle) { |
| 121 // TODO(turnidge): Assumes RawObject* is at offset zero. Fix. | 121 // TODO(turnidge): Assumes RawObject* is at offset zero. Fix. |
| 122 RawObject* raw = *(reinterpret_cast<RawObject**>(handle)); | 122 RawObject* raw = *(reinterpret_cast<RawObject**>(handle)); |
| 123 return !raw->IsHeapObject(); | 123 return !raw->IsHeapObject(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Returns the value of a Smi. | 126 // Returns the value of a Smi. |
| 127 static intptr_t SmiValue(Dart_Handle handle) { | 127 static intptr_t SmiValue(Dart_Handle handle) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // Start a scope in which no Dart API call backs are allowed. | 185 // Start a scope in which no Dart API call backs are allowed. |
| 186 #define START_NO_CALLBACK_SCOPE(isolate) \ | 186 #define START_NO_CALLBACK_SCOPE(isolate) \ |
| 187 isolate->IncrementNoCallbackScopeDepth() | 187 isolate->IncrementNoCallbackScopeDepth() |
| 188 | 188 |
| 189 // End a no Dart API call backs Scope. | 189 // End a no Dart API call backs Scope. |
| 190 #define END_NO_CALLBACK_SCOPE(isolate) \ | 190 #define END_NO_CALLBACK_SCOPE(isolate) \ |
| 191 isolate->DecrementNoCallbackScopeDepth() | 191 isolate->DecrementNoCallbackScopeDepth() |
| 192 | 192 |
| 193 #define CHECK_CALLBACK_STATE(isolate) \ | 193 #define CHECK_CALLBACK_STATE(isolate) \ |
| 194 if (isolate->no_callback_scope_depth() != 0) { \ | 194 if (isolate->no_callback_scope_depth() != 0) { \ |
| 195 return reinterpret_cast<Dart_Handle>(Api::CallbackError(isolate)); \ | 195 return reinterpret_cast<Dart_Handle>(Api::AcquiredError(isolate)); \ |
| 196 } \ | 196 } \ |
| 197 | 197 |
| 198 } // namespace dart. | 198 } // namespace dart. |
| 199 | 199 |
| 200 #endif // VM_DART_API_IMPL_H_ | 200 #endif // VM_DART_API_IMPL_H_ |
| OLD | NEW |