diff options
author | Andreas Gampe <agampe@google.com> | 2014-09-11 08:30:08 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-09-15 19:50:12 -0700 |
commit | 5a4b8a236030460651a3136397d23ca6744e7eb7 (patch) | |
tree | 0e43891398e416d3fa77c7de391bf4db4408e8ee /runtime/handle_scope.h | |
parent | 19f7c95491a053b818f914137fa73df0517b8792 (diff) | |
download | android_art-5a4b8a236030460651a3136397d23ca6744e7eb7.tar.gz android_art-5a4b8a236030460651a3136397d23ca6744e7eb7.tar.bz2 android_art-5a4b8a236030460651a3136397d23ca6744e7eb7.zip |
ART: Rename Handle hierarchy
Bring the names in line with normal OO principles: ConstHandle
becomes Handle, and Handle becomes MutableHandle.
Change-Id: I0f018eb7ba28bc422e3a23dd73a6cbe6fc2d2044
Diffstat (limited to 'runtime/handle_scope.h')
-rw-r--r-- | runtime/handle_scope.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/runtime/handle_scope.h b/runtime/handle_scope.h index 42ef77927c..99059f9e59 100644 --- a/runtime/handle_scope.h +++ b/runtime/handle_scope.h @@ -89,6 +89,12 @@ class PACKED(4) HandleScope { return Handle<mirror::Object>(&references_[i]); } + MutableHandle<mirror::Object> GetMutableHandle(size_t i) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE { + DCHECK_LT(i, number_of_references_); + return MutableHandle<mirror::Object>(&references_[i]); + } + void SetReference(size_t i, mirror::Object* object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE { DCHECK_LT(i, number_of_references_); @@ -139,14 +145,14 @@ class PACKED(4) HandleScope { // A wrapper which wraps around Object** and restores the pointer in the destructor. // TODO: Add more functionality. template<class T> -class HandleWrapper : public Handle<T> { +class HandleWrapper : public MutableHandle<T> { public: - HandleWrapper(T** obj, const Handle<T>& handle) - : Handle<T>(handle), obj_(obj) { + HandleWrapper(T** obj, const MutableHandle<T>& handle) + : MutableHandle<T>(handle), obj_(obj) { } ~HandleWrapper() { - *obj_ = Handle<T>::Get(); + *obj_ = MutableHandle<T>::Get(); } private: @@ -169,10 +175,10 @@ class PACKED(4) StackHandleScope FINAL : public HandleScope { return references_storage_[i].AsMirrorPtr(); } - Handle<mirror::Object> GetHandle(size_t i) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) + MutableHandle<mirror::Object> GetHandle(size_t i) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE { DCHECK_LT(i, number_of_references_); - return Handle<mirror::Object>(&references_storage_[i]); + return MutableHandle<mirror::Object>(&references_storage_[i]); } void SetReference(size_t i, mirror::Object* object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) @@ -182,9 +188,9 @@ class PACKED(4) StackHandleScope FINAL : public HandleScope { } template<class T> - Handle<T> NewHandle(T* object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + MutableHandle<T> NewHandle(T* object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { SetReference(pos_, object); - Handle<T> h(GetHandle(pos_)); + MutableHandle<T> h(GetHandle(pos_)); pos_++; return h; } @@ -192,7 +198,7 @@ class PACKED(4) StackHandleScope FINAL : public HandleScope { template<class T> HandleWrapper<T> NewHandleWrapper(T** object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { SetReference(pos_, *object); - Handle<T> h(GetHandle(pos_)); + MutableHandle<T> h(GetHandle(pos_)); pos_++; return HandleWrapper<T>(object, h); } |