diff options
author | 2016-10-06 15:13:58 -0700 | |
---|---|---|
committer | 2016-10-06 15:53:58 -0700 | |
commit | a058fdf0cf7435a13a6e8cae5e3a9bfa1513828d (patch) | |
tree | 85de1316f29f661372841d5feee16c370375fc16 /runtime/mirror/object_reference.h | |
parent | c4f3925490a73da8dc74884a1deb965d4ecaf14e (diff) |
Move mirror::Object setters to ObjPtr
Bug: 31113334
Test: test-art-host
Change-Id: I2c4c84645e194c3c435a4a6fd670176b0e98671f
Diffstat (limited to 'runtime/mirror/object_reference.h')
-rw-r--r-- | runtime/mirror/object_reference.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/mirror/object_reference.h b/runtime/mirror/object_reference.h index f4a358018e..573cb308bd 100644 --- a/runtime/mirror/object_reference.h +++ b/runtime/mirror/object_reference.h @@ -19,6 +19,7 @@ #include "base/mutex.h" // For Locks::mutator_lock_. #include "globals.h" +#include "obj_ptr.h" namespace art { namespace mirror { @@ -86,11 +87,18 @@ class MANAGED HeapReference : public ObjectReference<kPoisonHeapReferences, Mirr REQUIRES_SHARED(Locks::mutator_lock_) { return HeapReference<MirrorType>(mirror_ptr); } + + static HeapReference<MirrorType> FromObjPtr(ObjPtr<MirrorType> ptr) + REQUIRES_SHARED(Locks::mutator_lock_); + private: explicit HeapReference(MirrorType* mirror_ptr) REQUIRES_SHARED(Locks::mutator_lock_) : ObjectReference<kPoisonHeapReferences, MirrorType>(mirror_ptr) {} }; +static_assert(sizeof(mirror::HeapReference<mirror::Object>) == kHeapReferenceSize, + "heap reference size does not match"); + // Standard compressed reference used in the runtime. Used for StackReference and GC roots. template<class MirrorType> class MANAGED CompressedReference : public mirror::ObjectReference<false, MirrorType> { |