| Index: runtime/vm/dart_api_impl.h
|
| ===================================================================
|
| --- runtime/vm/dart_api_impl.h (revision 1989)
|
| +++ runtime/vm/dart_api_impl.h (working copy)
|
| @@ -14,10 +14,53 @@
|
| class LocalHandle;
|
| class PersistentHandle;
|
|
|
| +const char* CanonicalFunction(const char* func);
|
| +
|
| +#define CURRENT_FUNC CanonicalFunction(__FUNCTION__)
|
| +
|
| +// Checks that the current isolate is not NULL.
|
| +#define CHECK_ISOLATE(isolate) \
|
| + do { \
|
| + if ((isolate) == NULL) { \
|
| + FATAL1("%s expects there to be a current isolate. Did you " \
|
| + "forget to call Dart_CreateIsolate or Dart_EnterIsolate?", \
|
| + CURRENT_FUNC); \
|
| + } \
|
| + } while (0)
|
| +
|
| +// Checks that the current isolate is NULL.
|
| +#define CHECK_NO_ISOLATE(isolate) \
|
| + do { \
|
| + if ((isolate) != NULL) { \
|
| + FATAL1("%s expects there to be no current isolate. Did you " \
|
| + "forget to call Dart_ExitIsolate?", CURRENT_FUNC); \
|
| + } \
|
| + } while (0)
|
| +
|
| +// Checks that the current isolate is not NULL and that it has an API scope.
|
| +#define CHECK_ISOLATE_SCOPE(isolate) \
|
| + do { \
|
| + Isolate* tmp = (isolate); \
|
| + CHECK_ISOLATE(tmp); \
|
| + ApiState* state = tmp->api_state(); \
|
| + ASSERT(state); \
|
| + if (state->top_scope() == NULL) { \
|
| + FATAL1("%s expects to find a current scope. Did you forget to call " \
|
| + "Dart_EnterScope?", CURRENT_FUNC); \
|
| + } \
|
| + } while (0)
|
| +
|
| +#define DARTSCOPE_NOCHECKS(isolate) \
|
| + Isolate* __temp_isolate__ = (isolate); \
|
| + ASSERT(__temp_isolate__ != NULL); \
|
| + Zone zone(__temp_isolate__); \
|
| + HANDLESCOPE(__temp_isolate__);
|
| +
|
| #define DARTSCOPE(isolate) \
|
| - ASSERT(isolate != NULL); \
|
| - Zone zone(isolate); \
|
| - HANDLESCOPE(isolate); \
|
| + Isolate* __temp_isolate__ = (isolate); \
|
| + CHECK_ISOLATE_SCOPE(__temp_isolate__); \
|
| + Zone zone(__temp_isolate__); \
|
| + HANDLESCOPE(__temp_isolate__);
|
|
|
| class Api : AllStatic {
|
| public:
|
|
|