| 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" | 
| 11 | 11 | 
| 12 namespace dart { | 12 namespace dart { | 
| 13 | 13 | 
| 14 DECLARE_FLAG(bool, trace_api); |  | 
| 15 |  | 
| 16 class ApiLocalScope; | 14 class ApiLocalScope; | 
| 17 class ApiState; | 15 class ApiState; | 
| 18 class FinalizablePersistentHandle; | 16 class FinalizablePersistentHandle; | 
| 19 class LocalHandle; | 17 class LocalHandle; | 
| 20 class PersistentHandle; | 18 class PersistentHandle; | 
| 21 class ReusableObjectHandleScope; | 19 class ReusableObjectHandleScope; | 
| 22 | 20 | 
| 23 const char* CanonicalFunction(const char* func); | 21 const char* CanonicalFunction(const char* func); | 
| 24 | 22 | 
| 25 #define CURRENT_FUNC CanonicalFunction(__FUNCTION__) | 23 #define CURRENT_FUNC CanonicalFunction(__FUNCTION__) | 
| 26 | 24 | 
| 27 #if defined(DEBUG) |  | 
| 28 #define TRACE_API_CALL(name)                                                   \ |  | 
| 29   if (FLAG_trace_api) {                                                        \ |  | 
| 30     OS::Print("Calling API func: %s\n", name);                                 \ |  | 
| 31   } |  | 
| 32 #else |  | 
| 33 #define TRACE_API_CALL(name) |  | 
| 34 #endif |  | 
| 35 |  | 
| 36 |  | 
| 37 // Checks that the current isolate is not NULL. | 25 // Checks that the current isolate is not NULL. | 
| 38 #define CHECK_ISOLATE(isolate)                                                 \ | 26 #define CHECK_ISOLATE(isolate)                                                 \ | 
| 39   do {                                                                         \ | 27   do {                                                                         \ | 
| 40     TRACE_API_CALL(CURRENT_FUNC);                                              \ |  | 
| 41     if ((isolate) == NULL) {                                                   \ | 28     if ((isolate) == NULL) {                                                   \ | 
| 42       FATAL1("%s expects there to be a current isolate. Did you "              \ | 29       FATAL1("%s expects there to be a current isolate. Did you "              \ | 
| 43              "forget to call Dart_CreateIsolate or Dart_EnterIsolate?",        \ | 30              "forget to call Dart_CreateIsolate or Dart_EnterIsolate?",        \ | 
| 44              CURRENT_FUNC);                                                    \ | 31              CURRENT_FUNC);                                                    \ | 
| 45     }                                                                          \ | 32     }                                                                          \ | 
| 46   } while (0) | 33   } while (0) | 
| 47 | 34 | 
| 48 // Checks that the current isolate is NULL. | 35 // Checks that the current isolate is NULL. | 
| 49 #define CHECK_NO_ISOLATE(isolate)                                              \ | 36 #define CHECK_NO_ISOLATE(isolate)                                              \ | 
| 50   do {                                                                         \ | 37   do {                                                                         \ | 
| 51     TRACE_API_CALL(CURRENT_FUNC);                                              \ |  | 
| 52     if ((isolate) != NULL) {                                                   \ | 38     if ((isolate) != NULL) {                                                   \ | 
| 53       FATAL1("%s expects there to be no current isolate. Did you "             \ | 39       FATAL1("%s expects there to be no current isolate. Did you "             \ | 
| 54              "forget to call Dart_ExitIsolate?", CURRENT_FUNC);                \ | 40              "forget to call Dart_ExitIsolate?", CURRENT_FUNC);                \ | 
| 55     }                                                                          \ | 41     }                                                                          \ | 
| 56   } while (0) | 42   } while (0) | 
| 57 | 43 | 
| 58 // Checks that the current isolate is not NULL and that it has an API scope. | 44 // Checks that the current isolate is not NULL and that it has an API scope. | 
| 59 #define CHECK_API_SCOPE(thread)                                                \ | 45 #define CHECK_API_SCOPE(thread)                                                \ | 
| 60   do {                                                                         \ | 46   do {                                                                         \ | 
| 61     Thread* tmpT = (thread);                                                   \ | 47     Thread* tmpT = (thread);                                                   \ | 
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 303     return Api::NewError("%s: Cannot load after Dart_Precompile",              \ | 289     return Api::NewError("%s: Cannot load after Dart_Precompile",              \ | 
| 304                          CURRENT_FUNC);                                        \ | 290                          CURRENT_FUNC);                                        \ | 
| 305   }                                                                            \ | 291   }                                                                            \ | 
| 306 | 292 | 
| 307 #define ASSERT_CALLBACK_STATE(thread)                                         \ | 293 #define ASSERT_CALLBACK_STATE(thread)                                         \ | 
| 308   ASSERT(thread->no_callback_scope_depth() == 0) | 294   ASSERT(thread->no_callback_scope_depth() == 0) | 
| 309 | 295 | 
| 310 }  // namespace dart. | 296 }  // namespace dart. | 
| 311 | 297 | 
| 312 #endif  // VM_DART_API_IMPL_H_ | 298 #endif  // VM_DART_API_IMPL_H_ | 
| OLD | NEW | 
|---|