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

Unified Diff: runtime/vm/object.h

Issue 8334009: Use the distinguished class, ApiFailure, to signal when a Dart_Result is (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 | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 537)
+++ runtime/vm/object.h (working copy)
@@ -139,6 +139,7 @@
kExceptionHandlersClass,
kContextClass,
kContextScopeClass,
+ kApiFailureClass,
kMaxId,
kInvalidIndex = -1,
};
@@ -238,6 +239,7 @@
}
static RawClass* context_class() { return context_class_; }
static RawClass* context_scope_class() { return context_scope_class_; }
+ static RawClass* api_failure_class() { return api_failure_class_; }
static int GetSingletonClassIndex(const RawClass* raw_class);
static RawClass* GetSingletonClass(int index);
@@ -330,6 +332,7 @@
static RawClass* exception_handlers_class_; // Class of ExceptionHandlers.
static RawClass* context_class_; // Class of the Context vm object.
static RawClass* context_scope_class_; // Class of ContextScope vm object.
+ static RawClass* api_failure_class_; // Class of ApiFailure.
friend class Class;
@@ -1984,6 +1987,28 @@
};
+class ApiFailure : public Object {
+ public:
+ RawString* message() const { return raw_ptr()->message_; }
+ static intptr_t message_offset() {
+ return OFFSET_OF(RawApiFailure, message_);
+ }
+
+ static intptr_t InstanceSize() {
+ return RoundedAllocationSize(sizeof(RawApiFailure));
+ }
+
+ static RawApiFailure* New(const String& message,
+ Heap::Space space = Heap::kNew);
+
+ private:
+ void set_message(const String& message) const;
+
+ HEAP_OBJECT_IMPLEMENTATION(ApiFailure, Object);
+ friend class Class;
+};
+
+
// Instance is the base class for all instance objects (aka the Object class
// in Dart source code.
class Instance : public Object {
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698