Index: runtime/bin/dartutils.h |
diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h |
index a9b86f717a86186880706c82275cf5af67161afe..051086b74be8969ff49ae1f6400fef62d0c65947 100644 |
--- a/runtime/bin/dartutils.h |
+++ b/runtime/bin/dartutils.h |
@@ -207,6 +207,12 @@ class DartUtils { |
class CObject { |
public: |
+ // These match the constants in sdk/lib/io/common.dart. |
Søren Gjesse
2013/05/14 13:50:36
These constants should be moved. They are not part
Bill Hesse
2013/05/14 16:33:58
I would do this, but I don't know where you think
Søren Gjesse
2013/05/15 14:06:35
Let's create a new class NativePortRPC with these
|
+ static const int kSuccess = 0; |
+ static const int kArgumentError = 1; |
+ static const int kOSError = 2; |
+ static const int kFileClosedError = 3; |
+ |
explicit CObject(Dart_CObject *cobject) : cobject_(cobject) {} |
Dart_CObject::Type type() { return cobject_->type; } |
Dart_CObject::TypedDataType byte_array_type() { |
@@ -254,6 +260,9 @@ class CObject { |
static Dart_CObject* NewDouble(double value); |
static Dart_CObject* NewString(int length); |
static Dart_CObject* NewString(const char* str); |
Søren Gjesse
2013/05/14 13:50:36
I don't think this comment belongs here. It is spe
Bill Hesse
2013/05/14 16:33:58
Removed. But the RPC protocol is exactly the func
Søren Gjesse
2013/05/15 14:06:35
That's right, see comment above.
|
+ // A CObject array cannot be returned as the result, since errors are |
+ // encoded as arrays starting with a nonzero first element. It must be |
+ // wrapped in an array starting with kSuccess, and unwrapped by the receiver. |
static Dart_CObject* NewArray(int length); |
static Dart_CObject* NewUint8Array(int length); |
static Dart_CObject* NewExternalUint8Array( |