Chromium Code Reviews| Index: runtime/vm/dart_api_impl.h |
| diff --git a/runtime/vm/dart_api_impl.h b/runtime/vm/dart_api_impl.h |
| index 9e7cb5fd684b466731ed83b248518d85e45ea573..72c7c0ece8c303815d9355edeb1da14e654a46b2 100644 |
| --- a/runtime/vm/dart_api_impl.h |
| +++ b/runtime/vm/dart_api_impl.h |
| @@ -56,13 +56,12 @@ const char* CanonicalFunction(const char* func); |
| } while (0) |
| // Checks that the current isolate is not NULL and that it has an API scope. |
| -#define CHECK_ISOLATE_SCOPE(isolate) \ |
| +#define CHECK_API_SCOPE(thread) \ |
| do { \ |
| - Isolate* tmp = (isolate); \ |
| - CHECK_ISOLATE(tmp); \ |
| - ApiState* state = tmp->api_state(); \ |
| - ASSERT(state); \ |
| - if (state->top_scope() == NULL) { \ |
| + Thread* tmpT = (thread); \ |
| + Isolate* tmpI = (tmpT->isolate()); \ |
|
Ivan Posva
2015/11/25 20:19:51
Parens?
siva
2015/11/25 22:45:12
Done.
|
| + CHECK_ISOLATE(tmpI); \ |
| + if (tmpT->api_top_scope() == NULL) { \ |
| FATAL1("%s expects to find a current scope. Did you forget to call " \ |
| "Dart_EnterScope?", CURRENT_FUNC); \ |
| } \ |
| @@ -70,8 +69,7 @@ const char* CanonicalFunction(const char* func); |
| #define DARTSCOPE(thread) \ |
| Thread* T = (thread); \ |
| - Isolate* I = T->isolate(); \ |
| - CHECK_ISOLATE_SCOPE(I); \ |
| + CHECK_API_SCOPE(T); \ |
| HANDLESCOPE(T); |
| @@ -124,7 +122,7 @@ class Api : AllStatic { |
| }; |
| // Creates a new local handle. |
| - static Dart_Handle NewHandle(Isolate* isolate, RawObject* raw); |
| + static Dart_Handle NewHandle(Thread* thread, RawObject* raw); |
| // Unwraps the raw object from the handle. |
| static RawObject* UnwrapHandle(Dart_Handle object); |
| @@ -146,7 +144,7 @@ class Api : AllStatic { |
| // Returns an Error handle if isolate is in an inconsistent state |
| // or there was an error while finalizing classes. |
| // Returns a Success handle when no error condition exists. |
| - static Dart_Handle CheckAndFinalizePendingClasses(Isolate *isolate); |
| + static Dart_Handle CheckAndFinalizePendingClasses(Thread *thread); |
| // Casts the internal Isolate* type to the external Dart_Isolate type. |
| static Dart_Isolate CastIsolate(Isolate* isolate); |
| @@ -216,7 +214,7 @@ class Api : AllStatic { |
| } |
| // Retrieves the top ApiLocalScope. |
| - static ApiLocalScope* TopScope(Isolate* isolate); |
| + static ApiLocalScope* TopScope(Thread* thread); |
| // Performs one-time initialization needed by the API. |
| static void InitOnce(); |
| @@ -273,7 +271,7 @@ class Api : AllStatic { |
| const String& name); |
| private: |
| - static Dart_Handle InitNewHandle(Isolate* isolate, RawObject* raw); |
| + static Dart_Handle InitNewHandle(Thread* thread, RawObject* raw); |
| // Thread local key used by the API. Currently holds the current |
| // ApiNativeScope if any. |