Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Unified Diff: runtime/include/dart_api.h

Issue 8401010: Add DART_CHECKVALID (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/include/dart_api.h
===================================================================
--- runtime/include/dart_api.h (revision 969)
+++ runtime/include/dart_api.h (working copy)
@@ -79,13 +79,28 @@
// 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 invalid handles.
+DART_EXPORT void _Dart_ReportInvalidHandle(const char* file,
+ int line,
+ const char* handle_string,
+ const char* error);
+// Aborts the process if 'handle' is invalid.
+#define DART_CHECK_VALID(handle) \
+ if (!Dart_IsValid((handle))) { \
+ _Dart_ReportInvalidHandle(__FILE__, __LINE__, \
+ #handle, Dart_GetError(handle)); \
+ }
+// 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);
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698