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

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') | runtime/vm/dart_api_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | runtime/vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698