diff options
author | 2016-10-06 17:44:26 -0700 | |
---|---|---|
committer | 2016-10-12 09:49:49 -0700 | |
commit | 9d156d500801accee919b6d51e22d6ddcdcd4a05 (patch) | |
tree | 92129562c0ba1673c660297f26444a4a2ad31459 /runtime/debugger.cc | |
parent | 078483d4dfd049d5b3f192a99e2dfdc355e4754f (diff) |
Move Heap parameters to ObjPtr
Deleted some unused object dumping code.
Test: test-art-host
Bug: 31113334
Change-Id: I747220caafe6679591fd4b361d7f50383a046164
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r-- | runtime/debugger.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 7006f70687..d8a6ba9f7f 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -892,15 +892,16 @@ JDWP::JdwpError Dbg::GetInstanceCounts(const std::vector<JDWP::RefTypeId>& class std::vector<uint64_t>* counts) { gc::Heap* heap = Runtime::Current()->GetHeap(); heap->CollectGarbage(false); - std::vector<mirror::Class*> classes; + StackHandleScopeCollection hs(Thread::Current()); + std::vector<Handle<mirror::Class>> classes; counts->clear(); for (size_t i = 0; i < class_ids.size(); ++i) { JDWP::JdwpError error; - mirror::Class* c = DecodeClass(class_ids[i], &error); + ObjPtr<mirror::Class> c = DecodeClass(class_ids[i], &error); if (c == nullptr) { return error; } - classes.push_back(c); + classes.push_back(hs.NewHandle(c)); counts->push_back(0); } heap->CountInstances(classes, false, &(*counts)[0]); @@ -913,12 +914,13 @@ JDWP::JdwpError Dbg::GetInstances(JDWP::RefTypeId class_id, int32_t max_count, // We only want reachable instances, so do a GC. heap->CollectGarbage(false); JDWP::JdwpError error; - mirror::Class* c = DecodeClass(class_id, &error); + ObjPtr<mirror::Class> c = DecodeClass(class_id, &error); if (c == nullptr) { return error; } - std::vector<mirror::Object*> raw_instances; - Runtime::Current()->GetHeap()->GetInstances(c, max_count, raw_instances); + std::vector<ObjPtr<mirror::Object>> raw_instances; + StackHandleScope<1> hs(Thread::Current()); + Runtime::Current()->GetHeap()->GetInstances(hs.NewHandle(c), max_count, raw_instances); for (size_t i = 0; i < raw_instances.size(); ++i) { instances->push_back(gRegistry->Add(raw_instances[i])); } @@ -930,11 +932,11 @@ JDWP::JdwpError Dbg::GetReferringObjects(JDWP::ObjectId object_id, int32_t max_c gc::Heap* heap = Runtime::Current()->GetHeap(); heap->CollectGarbage(false); JDWP::JdwpError error; - mirror::Object* o = gRegistry->Get<mirror::Object*>(object_id, &error); + ObjPtr<mirror::Object> o = gRegistry->Get<mirror::Object*>(object_id, &error); if (o == nullptr) { return JDWP::ERR_INVALID_OBJECT; } - std::vector<mirror::Object*> raw_instances; + std::vector<ObjPtr<mirror::Object>> raw_instances; heap->GetReferringObjects(o, max_count, raw_instances); for (size_t i = 0; i < raw_instances.size(); ++i) { referring_objects->push_back(gRegistry->Add(raw_instances[i])); |