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

Unified Diff: runtime/bin/dartutils.h

Issue 10916081: Add secure sockets to dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove some magic numbers, edit TODOs. Created 8 years, 1 month 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
Index: runtime/bin/dartutils.h
diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h
index 93f700194e87d0f805e35ecf5a58a909d5ce3409..a92a54e232b244dbaf5f81202d2b518ae4c75b56 100644
--- a/runtime/bin/dartutils.h
+++ b/runtime/bin/dartutils.h
@@ -10,6 +10,19 @@
#include "include/dart_api.h"
#include "platform/globals.h"
+/* Handles error handles returned from Dart API functions. If a value
+ * is an error, uses Dart_PropagateError to throw it to the enclosing
+ * Dart activation. Otherwise, returns the original handle.
+ *
+ * This function can be used to wrap most API functions, but API
+ * functions can also be nested without this error check, since all
+ * API functions return any error handles passed in as arguments, unchanged.
+ */
+static inline Dart_Handle ThrowIfError(Dart_Handle handle) {
+ if (Dart_IsError(handle)) Dart_PropagateError(handle);
+ return handle;
+}
+
class CommandLineOptions {
public:
explicit CommandLineOptions(int max_count)
@@ -105,10 +118,16 @@ class DartUtils {
static bool PostNull(Dart_Port port_id);
static bool PostInt32(Dart_Port port_id, int32_t value);
+ static Dart_Handle GetDartClass(const char* library_url,
+ const char* class_name);
// Create a new Dart OSError object with the current OS error.
static Dart_Handle NewDartOSError();
// Create a new Dart OSError object with the provided OS error.
static Dart_Handle NewDartOSError(OSError* os_error);
+ static Dart_Handle NewDartExceptionWithMessage(const char* library_url,
+ const char* exception_name,
+ const char* message);
+ static Dart_Handle NewDartArgumentError(const char* message);
// Create a new Dart String object from a C String.
static Dart_Handle NewString(const char* str) {
« no previous file with comments | « runtime/bin/bin.gypi ('k') | runtime/bin/dartutils.cc » ('j') | runtime/bin/tls_socket.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698