summaryrefslogtreecommitdiff
path: root/runtime/handle_scope-inl.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2019-01-04 16:08:51 -0800
committer Andreas Gampe <agampe@google.com> 2019-01-09 12:38:30 -0800
commita1ffdba7e285435cbb3538473f25eb7cb47cfd66 (patch)
tree35b1ad4e66839425ef3ff52287e53dec4e5a348e /runtime/handle_scope-inl.h
parent5a0430d0239481f4efb252d60ec9641703b8d456 (diff)
ART: IWYU handle_scope
Move wrappers to their own header. Forward-declare handles. Bug: 119869270 Test: m Change-Id: I9fba4df9b589cec07c7f687791ddbed81d188410
Diffstat (limited to 'runtime/handle_scope-inl.h')
-rw-r--r--runtime/handle_scope-inl.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/handle_scope-inl.h b/runtime/handle_scope-inl.h
index f61c700a36..765ed7d53b 100644
--- a/runtime/handle_scope-inl.h
+++ b/runtime/handle_scope-inl.h
@@ -21,6 +21,7 @@
#include "base/mutex.h"
#include "handle.h"
+#include "handle_wrapper.h"
#include "obj_ptr-inl.h"
#include "thread-current-inl.h"
#include "verify_object.h"
@@ -106,6 +107,15 @@ inline bool HandleScope::Contains(StackReference<mirror::Object>* handle_scope_e
handle_scope_entry <= &GetReferences()[number_of_references_ - 1];
}
+template <typename Visitor>
+inline void HandleScope::VisitRoots(Visitor& visitor) {
+ for (size_t i = 0, count = NumberOfReferences(); i < count; ++i) {
+ // GetReference returns a pointer to the stack reference within the handle scope. If this
+ // needs to be updated, it will be done by the root visitor.
+ visitor.VisitRootIfNonNull(GetHandle(i).GetReference());
+ }
+}
+
template<size_t kNumReferences> template<class T>
inline MutableHandle<T> FixedSizeHandleScope<kNumReferences>::NewHandle(T* object) {
SetReference(pos_, object);