Chromium Code Reviews| 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 INCLUDE_DART_API_H_ | 5 #ifndef INCLUDE_DART_API_H_ |
| 6 #define INCLUDE_DART_API_H_ | 6 #define INCLUDE_DART_API_H_ |
| 7 | 7 |
| 8 #ifdef __cplusplus | 8 #ifdef __cplusplus |
| 9 #define DART_EXTERN_C extern "C" | 9 #define DART_EXTERN_C extern "C" |
| 10 #else | 10 #else |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 | 72 |
| 73 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); | 73 typedef void (*Dart_NativeFunction)(Dart_NativeArguments arguments); |
| 74 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, | 74 typedef Dart_NativeFunction (*Dart_NativeEntryResolver)(Dart_Handle name, |
| 75 int num_of_arguments); | 75 int num_of_arguments); |
| 76 typedef Dart_Handle (*Dart_LibraryTagHandler)(Dart_LibraryTag tag, | 76 typedef Dart_Handle (*Dart_LibraryTagHandler)(Dart_LibraryTag tag, |
| 77 Dart_Handle library, | 77 Dart_Handle library, |
| 78 Dart_Handle url); | 78 Dart_Handle url); |
| 79 | 79 |
| 80 // TODO(iposva): This is a placeholder for the eventual external Dart API. | 80 // TODO(iposva): This is a placeholder for the eventual external Dart API. |
| 81 | 81 |
| 82 // Return value handling after a Dart API call. | 82 // Returns true if 'handle' is valid and false if invalid. |
| 83 DART_EXPORT bool Dart_IsValid(const Dart_Handle& result); | 83 DART_EXPORT bool Dart_IsValid(const Dart_Handle& handle); |
| 84 | 84 |
| 85 DART_EXPORT const char* Dart_GetError(const Dart_Handle& result); | 85 // Internal routine used for reporting bad handles. |
| 86 DART_EXPORT Dart_Handle Dart_Error(const char* value); | 86 DART_EXPORT void _Dart_ReportInvalidHandle(bool fatal, |
| 87 const char* file, | |
| 88 int line, | |
| 89 const char* handle_string, | |
| 90 const char* error); | |
|
siva
2011/10/27 21:15:54
I am assuming you want the external users of this
turnidge
2011/10/27 21:55:20
I don't want external users to call _Dart_ReportIn
| |
| 87 | 91 |
| 92 // Aborts the process if 'handle' is invalid. | |
| 93 #define DART_CHECKVALID(handle) \ | |
|
turnidge
2011/10/27 21:55:20
Which do you like better... DART_CHECKVALID or DAR
| |
| 94 if (!Dart_IsValid((handle))) { \ | |
| 95 _Dart_ReportInvalidHandle(true, __FILE__, __LINE__, \ | |
| 96 #handle, Dart_GetError(handle)); \ | |
| 97 } | |
|
siva
2011/10/27 21:15:54
Not sure what the style should be here, indented w
turnidge
2011/10/27 21:55:20
Fixed.
| |
| 98 | |
| 99 // Gets the error message associated with an invalid handle. | |
| 100 DART_EXPORT const char* Dart_GetError(const Dart_Handle& handle); | |
| 101 | |
| 102 // Produces an invalid handle with an associated error message | |
| 103 DART_EXPORT Dart_Handle Dart_Error(const char* error); | |
| 88 | 104 |
| 89 // Initialize the VM with commmand line flags. | 105 // Initialize the VM with commmand line flags. |
| 90 DART_EXPORT bool Dart_Initialize(int argc, char** argv, | 106 DART_EXPORT bool Dart_Initialize(int argc, char** argv, |
| 91 Dart_IsolateInitCallback callback); | 107 Dart_IsolateInitCallback callback); |
| 92 | 108 |
| 93 | 109 |
| 94 // Isolate handling. | 110 // Isolate handling. |
| 95 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot, | 111 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const Dart_Snapshot* snapshot, |
| 96 void* data); | 112 void* data); |
| 97 DART_EXPORT void Dart_ShutdownIsolate(); | 113 DART_EXPORT void Dart_ShutdownIsolate(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 // External pprof support for gathering and dumping symbolic information | 379 // External pprof support for gathering and dumping symbolic information |
| 364 // that can be used for better profile reports for dynamically generated | 380 // that can be used for better profile reports for dynamically generated |
| 365 // code. | 381 // code. |
| 366 DART_EXPORT void Dart_InitPprofSupport(); | 382 DART_EXPORT void Dart_InitPprofSupport(); |
| 367 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); | 383 DART_EXPORT void Dart_GetPprofSymbolInfo(void** buffer, int* buffer_size); |
| 368 | 384 |
| 369 // Check set vm flags. | 385 // Check set vm flags. |
| 370 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); | 386 DART_EXPORT bool Dart_IsVMFlagSet(const char* flag_name); |
| 371 | 387 |
| 372 #endif // INCLUDE_DART_API_H_ | 388 #endif // INCLUDE_DART_API_H_ |
| OLD | NEW |