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/native_arguments.h" | 9 #include "vm/native_arguments.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 Isolate* tmp = (isolate); \ | 61 Isolate* tmp = (isolate); \ |
62 CHECK_ISOLATE(tmp); \ | 62 CHECK_ISOLATE(tmp); \ |
63 ApiState* state = tmp->api_state(); \ | 63 ApiState* state = tmp->api_state(); \ |
64 ASSERT(state); \ | 64 ASSERT(state); \ |
65 if (state->top_scope() == NULL) { \ | 65 if (state->top_scope() == NULL) { \ |
66 FATAL1("%s expects to find a current scope. Did you forget to call " \ | 66 FATAL1("%s expects to find a current scope. Did you forget to call " \ |
67 "Dart_EnterScope?", CURRENT_FUNC); \ | 67 "Dart_EnterScope?", CURRENT_FUNC); \ |
68 } \ | 68 } \ |
69 } while (0) | 69 } while (0) |
70 | 70 |
71 #define DARTSCOPE(isolate) \ | 71 #define DARTSCOPE(thread) \ |
72 Isolate* __temp_isolate__ = (isolate); \ | 72 Thread* T = (thread); \ |
73 CHECK_ISOLATE_SCOPE(__temp_isolate__); \ | 73 Isolate* I = T->isolate(); \ |
74 HANDLESCOPE(__temp_isolate__); | 74 CHECK_ISOLATE_SCOPE(I); \ |
| 75 HANDLESCOPE(T); |
75 | 76 |
76 | 77 |
77 #define RETURN_TYPE_ERROR(isolate, dart_handle, type) \ | 78 #define RETURN_TYPE_ERROR(isolate, dart_handle, type) \ |
78 do { \ | 79 do { \ |
79 const Object& tmp = \ | 80 const Object& tmp = \ |
80 Object::Handle(isolate, Api::UnwrapHandle((dart_handle))); \ | 81 Object::Handle(isolate, Api::UnwrapHandle((dart_handle))); \ |
81 if (tmp.IsNull()) { \ | 82 if (tmp.IsNull()) { \ |
82 return Api::NewError("%s expects argument '%s' to be non-null.", \ | 83 return Api::NewError("%s expects argument '%s' to be non-null.", \ |
83 CURRENT_FUNC, #dart_handle); \ | 84 CURRENT_FUNC, #dart_handle); \ |
84 } else if (tmp.IsError()) { \ | 85 } else if (tmp.IsError()) { \ |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 if (isolate->no_callback_scope_depth() != 0) { \ | 315 if (isolate->no_callback_scope_depth() != 0) { \ |
315 return reinterpret_cast<Dart_Handle>(Api::AcquiredError(isolate)); \ | 316 return reinterpret_cast<Dart_Handle>(Api::AcquiredError(isolate)); \ |
316 } \ | 317 } \ |
317 | 318 |
318 #define ASSERT_CALLBACK_STATE(isolate) \ | 319 #define ASSERT_CALLBACK_STATE(isolate) \ |
319 ASSERT(isolate->no_callback_scope_depth() == 0) | 320 ASSERT(isolate->no_callback_scope_depth() == 0) |
320 | 321 |
321 } // namespace dart. | 322 } // namespace dart. |
322 | 323 |
323 #endif // VM_DART_API_IMPL_H_ | 324 #endif // VM_DART_API_IMPL_H_ |
OLD | NEW |