Cleanup thread access in StackVisitor
Adds method StackVisitor::GetThread to give access to the visited
Thread* so we no longer need to copy that pointer in subclasses.
Also adds a few missing const and DISALLOW_COPY_AND_ASSIGN.
Change-Id: I57649ee7742ef4ef1e01447ac2fbb66f977b22eb
diff --git a/runtime/profiler.cc b/runtime/profiler.cc
index 7e8c551..6a77a9e 100644
--- a/runtime/profiler.cc
+++ b/runtime/profiler.cc
@@ -57,7 +57,8 @@
class BoundedStackVisitor : public StackVisitor {
public:
BoundedStackVisitor(std::vector<std::pair<ArtMethod*, uint32_t>>* stack,
- Thread* thread, uint32_t max_depth)
+ Thread* thread,
+ uint32_t max_depth)
SHARED_REQUIRES(Locks::mutator_lock_)
: StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
stack_(stack),
@@ -80,9 +81,11 @@
}
private:
- std::vector<std::pair<ArtMethod*, uint32_t>>* stack_;
+ std::vector<std::pair<ArtMethod*, uint32_t>>* const stack_;
const uint32_t max_depth_;
uint32_t depth_;
+
+ DISALLOW_COPY_AND_ASSIGN(BoundedStackVisitor);
};
// This is called from either a thread list traversal or from a checkpoint. Regardless