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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } \ | 68 } \ |
69 } while (0) | 69 } while (0) |
70 | 70 |
71 #define DARTSCOPE(thread) \ | 71 #define DARTSCOPE(thread) \ |
72 Thread* T = (thread); \ | 72 Thread* T = (thread); \ |
73 Isolate* I = T->isolate(); \ | 73 Isolate* I = T->isolate(); \ |
74 CHECK_ISOLATE_SCOPE(I); \ | 74 CHECK_ISOLATE_SCOPE(I); \ |
75 HANDLESCOPE(T); | 75 HANDLESCOPE(T); |
76 | 76 |
77 | 77 |
78 #define RETURN_TYPE_ERROR(isolate, dart_handle, type) \ | 78 #define RETURN_TYPE_ERROR(zone, dart_handle, type) \ |
79 do { \ | 79 do { \ |
80 const Object& tmp = \ | 80 const Object& tmp = \ |
81 Object::Handle(isolate, Api::UnwrapHandle((dart_handle))); \ | 81 Object::Handle(zone, Api::UnwrapHandle((dart_handle))); \ |
82 if (tmp.IsNull()) { \ | 82 if (tmp.IsNull()) { \ |
83 return Api::NewError("%s expects argument '%s' to be non-null.", \ | 83 return Api::NewError("%s expects argument '%s' to be non-null.", \ |
84 CURRENT_FUNC, #dart_handle); \ | 84 CURRENT_FUNC, #dart_handle); \ |
85 } else if (tmp.IsError()) { \ | 85 } else if (tmp.IsError()) { \ |
86 return dart_handle; \ | 86 return dart_handle; \ |
87 } \ | 87 } \ |
88 return Api::NewError("%s expects argument '%s' to be of type %s.", \ | 88 return Api::NewError("%s expects argument '%s' to be of type %s.", \ |
89 CURRENT_FUNC, #dart_handle, #type); \ | 89 CURRENT_FUNC, #dart_handle, #type); \ |
90 } while (0) | 90 } while (0) |
91 | 91 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 // Creates a new local handle. | 126 // Creates a new local handle. |
127 static Dart_Handle NewHandle(Isolate* isolate, RawObject* raw); | 127 static Dart_Handle NewHandle(Isolate* isolate, RawObject* raw); |
128 | 128 |
129 // Unwraps the raw object from the handle. | 129 // Unwraps the raw object from the handle. |
130 static RawObject* UnwrapHandle(Dart_Handle object); | 130 static RawObject* UnwrapHandle(Dart_Handle object); |
131 | 131 |
132 // Unwraps a raw Type from the handle. The handle will be null if | 132 // Unwraps a raw Type from the handle. The handle will be null if |
133 // the object was not of the requested Type. | 133 // the object was not of the requested Type. |
134 #define DECLARE_UNWRAP(Type) \ | 134 #define DECLARE_UNWRAP(Type) \ |
135 static const Type& Unwrap##Type##Handle(Isolate* isolate, \ | 135 static const Type& Unwrap##Type##Handle(Zone* zone, \ |
136 Dart_Handle object); | 136 Dart_Handle object); |
137 CLASS_LIST_FOR_HANDLES(DECLARE_UNWRAP) | 137 CLASS_LIST_FOR_HANDLES(DECLARE_UNWRAP) |
138 #undef DECLARE_UNWRAP | 138 #undef DECLARE_UNWRAP |
139 | 139 |
140 // Unwraps the raw object from the handle using a reused handle. | 140 // Unwraps the raw object from the handle using a reused handle. |
141 static const String& UnwrapStringHandle( | 141 static const String& UnwrapStringHandle( |
142 const ReusableObjectHandleScope& reused, Dart_Handle object); | 142 const ReusableObjectHandleScope& reused, Dart_Handle object); |
143 static const Instance& UnwrapInstanceHandle( | 143 static const Instance& UnwrapInstanceHandle( |
144 const ReusableObjectHandleScope& reused, Dart_Handle object); | 144 const ReusableObjectHandleScope& reused, Dart_Handle object); |
145 | 145 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 return Api::NewError("%s: Cannot load after Dart_Precompile", \ | 321 return Api::NewError("%s: Cannot load after Dart_Precompile", \ |
322 CURRENT_FUNC); \ | 322 CURRENT_FUNC); \ |
323 } \ | 323 } \ |
324 | 324 |
325 #define ASSERT_CALLBACK_STATE(isolate) \ | 325 #define ASSERT_CALLBACK_STATE(isolate) \ |
326 ASSERT(isolate->no_callback_scope_depth() == 0) | 326 ASSERT(isolate->no_callback_scope_depth() == 0) |
327 | 327 |
328 } // namespace dart. | 328 } // namespace dart. |
329 | 329 |
330 #endif // VM_DART_API_IMPL_H_ | 330 #endif // VM_DART_API_IMPL_H_ |
OLD | NEW |