diff options
Diffstat (limited to 'runtime/handle_scope-inl.h')
-rw-r--r-- | runtime/handle_scope-inl.h | 10 |
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); |