summaryrefslogtreecommitdiff
path: root/runtime/object_utils.h
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2014-05-16 09:59:29 -0700
committer Mathieu Chartier <mathieuc@google.com> 2014-05-16 10:36:37 -0700
commitdb2633ce0358c704f97130a94b582602cb01d14a (patch)
treeab941b728fe4343eb9872abc85755640bf059800 /runtime/object_utils.h
parentf59c6dda4928cfb05d32a56fd161e3f86a9ca560 (diff)
Change ObjectLock to take Handle instead of Handle pointer.
Change-Id: I9abdcdc5c9c9174634336b9250ab24c6aee434ec
Diffstat (limited to 'runtime/object_utils.h')
-rw-r--r--runtime/object_utils.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/runtime/object_utils.h b/runtime/object_utils.h
index 0dd6ca1134..b1e8c099b7 100644
--- a/runtime/object_utils.h
+++ b/runtime/object_utils.h
@@ -38,33 +38,31 @@ namespace art {
template <typename T>
class ObjectLock {
public:
- explicit ObjectLock(Thread* self, const Handle<T>* object)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ ObjectLock(Thread* self, Handle<T> object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
: self_(self), obj_(object) {
- CHECK(object != nullptr);
- CHECK(object->Get() != nullptr);
- obj_->Get()->MonitorEnter(self_);
+ CHECK(object.Get() != nullptr);
+ obj_->MonitorEnter(self_);
}
~ObjectLock() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- obj_->Get()->MonitorExit(self_);
+ obj_->MonitorExit(self_);
}
void WaitIgnoringInterrupts() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- Monitor::Wait(self_, obj_->Get(), 0, 0, false, kWaiting);
+ Monitor::Wait(self_, obj_.Get(), 0, 0, false, kWaiting);
}
void Notify() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- obj_->Get()->Notify(self_);
+ obj_->Notify(self_);
}
void NotifyAll() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- obj_->Get()->NotifyAll(self_);
+ obj_->NotifyAll(self_);
}
private:
Thread* const self_;
- const Handle<T>* const obj_;
+ Handle<T> const obj_;
DISALLOW_COPY_AND_ASSIGN(ObjectLock);
};