Chromium Code Reviews| Index: runtime/include/dart_api.h |
| =================================================================== |
| --- runtime/include/dart_api.h (revision 778) |
| +++ runtime/include/dart_api.h (working copy) |
| @@ -79,13 +79,29 @@ |
| // TODO(iposva): This is a placeholder for the eventual external Dart API. |
| -// Return value handling after a Dart API call. |
| -DART_EXPORT bool Dart_IsValid(const Dart_Handle& result); |
| +// Returns true if 'handle' is valid and false if invalid. |
| +DART_EXPORT bool Dart_IsValid(const Dart_Handle& handle); |
| -DART_EXPORT const char* Dart_GetError(const Dart_Handle& result); |
| -DART_EXPORT Dart_Handle Dart_Error(const char* value); |
| +// Internal routine used for reporting bad handles. |
| +DART_EXPORT void _Dart_ReportInvalidHandle(bool fatal, |
| + const char* file, |
| + int line, |
| + const char* handle_string, |
| + 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
|
| +// Aborts the process if 'handle' is invalid. |
| +#define DART_CHECKVALID(handle) \ |
|
turnidge
2011/10/27 21:55:20
Which do you like better... DART_CHECKVALID or DAR
|
| + if (!Dart_IsValid((handle))) { \ |
| + _Dart_ReportInvalidHandle(true, __FILE__, __LINE__, \ |
| + #handle, Dart_GetError(handle)); \ |
| +} |
|
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.
|
| +// Gets the error message associated with an invalid handle. |
| +DART_EXPORT const char* Dart_GetError(const Dart_Handle& handle); |
| + |
| +// Produces an invalid handle with an associated error message |
| +DART_EXPORT Dart_Handle Dart_Error(const char* error); |
| + |
| // Initialize the VM with commmand line flags. |
| DART_EXPORT bool Dart_Initialize(int argc, char** argv, |
| Dart_IsolateInitCallback callback); |