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

Unified Diff: runtime/vm/object.h

Issue 510613002: Add passive handle types PassiveObject and PassiveInstance to allow (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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/raw_object_snapshot.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 39567)
+++ runtime/vm/object.h (working copy)
@@ -692,6 +692,54 @@
};
+class PassiveObject : public Object {
+ public:
+ void operator=(RawObject* value) {
+ raw_ = value;
+ }
+ void operator^=(RawObject* value) {
+ raw_ = value;
+ }
+ static PassiveObject& Handle(Isolate* I, RawObject* raw_ptr) {
+ PassiveObject* obj =
+ reinterpret_cast<PassiveObject*>(VMHandles::AllocateHandle(I));
+ obj->raw_ = raw_ptr;
+ obj->set_vtable(NULL);
+ return *obj;
+ }
+ static PassiveObject& Handle(RawObject* raw_ptr) {
+ return Handle(Isolate::Current(), raw_ptr);
+ }
+ static PassiveObject& Handle() {
+ return Handle(Isolate::Current(), Object::null());
+ }
+ static PassiveObject& Handle(Isolate* I) {
+ return Handle(I, Object::null());
+ }
+ static PassiveObject& ZoneHandle(Isolate* I, RawObject* raw_ptr) {
+ PassiveObject* obj = reinterpret_cast<PassiveObject*>(
+ VMHandles::AllocateZoneHandle(I));
+ obj->raw_ = raw_ptr;
+ obj->set_vtable(NULL);
+ return *obj;
+ }
+ static PassiveObject& ZoneHandle(RawObject* raw_ptr) {
+ return ZoneHandle(Isolate::Current(), raw_ptr);
+ }
+ static PassiveObject& ZoneHandle() {
+ return ZoneHandle(Isolate::Current(), Object::null());
+ }
+ static PassiveObject& ZoneHandle(Isolate* I) {
+ return ZoneHandle(I, Object::null());
+ }
+
+ private:
+ PassiveObject() : Object() {}
+ DISALLOW_ALLOCATION();
+ DISALLOW_COPY_AND_ASSIGN(PassiveObject);
+};
+
+
class Class : public Object {
public:
intptr_t instance_size() const {
« no previous file with comments | « no previous file | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698