summaryrefslogtreecommitdiffstats
path: root/runtime/handle.h
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-09-11 08:30:08 -0700
committerAndreas Gampe <agampe@google.com>2014-09-15 19:50:12 -0700
commit5a4b8a236030460651a3136397d23ca6744e7eb7 (patch)
tree0e43891398e416d3fa77c7de391bf4db4408e8ee /runtime/handle.h
parent19f7c95491a053b818f914137fa73df0517b8792 (diff)
downloadart-5a4b8a236030460651a3136397d23ca6744e7eb7.tar.gz
art-5a4b8a236030460651a3136397d23ca6744e7eb7.tar.bz2
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.h')
-rw-r--r--runtime/handle.h51
1 files changed, 26 insertions, 25 deletions
diff --git a/runtime/handle.h b/runtime/handle.h
index 06938e51c0..addb6638b6 100644
--- a/runtime/handle.h
+++ b/runtime/handle.h
@@ -30,23 +30,23 @@ template<class T> class Handle;
// Handles are memory locations that contain GC roots. As the mirror::Object*s within a handle are
// GC visible then the GC may move the references within them, something that couldn't be done with
-// a wrap pointer. Handles are generally allocated within HandleScopes. ConstHandle is a super-class
-// of Handle and doesn't support assignment operations.
+// a wrap pointer. Handles are generally allocated within HandleScopes. Handle is a super-class
+// of MutableHandle and doesn't support assignment operations.
template<class T>
-class ConstHandle {
+class Handle {
public:
- ConstHandle() : reference_(nullptr) {
+ Handle() : reference_(nullptr) {
}
- ALWAYS_INLINE ConstHandle(const ConstHandle<T>& handle) : reference_(handle.reference_) {
+ ALWAYS_INLINE Handle(const Handle<T>& handle) : reference_(handle.reference_) {
}
- ALWAYS_INLINE ConstHandle<T>& operator=(const ConstHandle<T>& handle) {
+ ALWAYS_INLINE Handle<T>& operator=(const Handle<T>& handle) {
reference_ = handle.reference_;
return *this;
}
- ALWAYS_INLINE explicit ConstHandle(StackReference<T>* reference) : reference_(reference) {
+ ALWAYS_INLINE explicit Handle(StackReference<T>* reference) : reference_(reference) {
}
ALWAYS_INLINE T& operator*() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -73,11 +73,11 @@ class ConstHandle {
StackReference<T>* reference_;
template<typename S>
- explicit ConstHandle(StackReference<S>* reference)
+ explicit Handle(StackReference<S>* reference)
: reference_(reinterpret_cast<StackReference<T>*>(reference)) {
}
template<typename S>
- explicit ConstHandle(const ConstHandle<S>& handle)
+ explicit Handle(const Handle<S>& handle)
: reference_(reinterpret_cast<StackReference<T>*>(handle.reference_)) {
}
@@ -91,7 +91,7 @@ class ConstHandle {
private:
friend class BuildGenericJniFrameVisitor;
- template<class S> friend class ConstHandle;
+ template<class S> friend class Handle;
friend class HandleScope;
template<class S> friend class HandleWrapper;
template<size_t kNumReferences> friend class StackHandleScope;
@@ -99,42 +99,43 @@ class ConstHandle {
// Handles that support assignment.
template<class T>
-class Handle : public ConstHandle<T> {
+class MutableHandle : public Handle<T> {
public:
- Handle() {
+ MutableHandle() {
}
- ALWAYS_INLINE Handle(const Handle<T>& handle) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
- : ConstHandle<T>(handle.reference_) {
+ ALWAYS_INLINE MutableHandle(const MutableHandle<T>& handle)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ : Handle<T>(handle.reference_) {
}
- ALWAYS_INLINE Handle<T>& operator=(const Handle<T>& handle)
+ ALWAYS_INLINE MutableHandle<T>& operator=(const MutableHandle<T>& handle)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ConstHandle<T>::operator=(handle);
+ Handle<T>::operator=(handle);
return *this;
}
- ALWAYS_INLINE explicit Handle(StackReference<T>* reference)
+ ALWAYS_INLINE explicit MutableHandle(StackReference<T>* reference)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
- : ConstHandle<T>(reference) {
+ : Handle<T>(reference) {
}
ALWAYS_INLINE T* Assign(T* reference) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- StackReference<T>* ref = ConstHandle<T>::GetReference();
+ StackReference<T>* ref = Handle<T>::GetReference();
T* const old = ref->AsMirrorPtr();
ref->Assign(reference);
return old;
}
template<typename S>
- explicit Handle(const Handle<S>& handle) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
- : ConstHandle<T>(handle) {
+ explicit MutableHandle(const MutableHandle<S>& handle) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ : Handle<T>(handle) {
}
protected:
template<typename S>
- explicit Handle(StackReference<S>* reference) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
- : ConstHandle<T>(reference) {
+ explicit MutableHandle(StackReference<S>* reference) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ : Handle<T>(reference) {
}
private:
@@ -146,9 +147,9 @@ class Handle : public ConstHandle<T> {
// A special case of Handle that only holds references to null.
template<class T>
-class NullHandle : public ConstHandle<T> {
+class NullHandle : public Handle<T> {
public:
- NullHandle() : ConstHandle<T>(&null_ref_) {
+ NullHandle() : Handle<T>(&null_ref_) {
}
private: