diff options
author | Richard Uhler <ruhler@google.com> | 2014-12-23 09:48:51 -0800 |
---|---|---|
committer | Richard Uhler <ruhler@google.com> | 2015-01-13 16:32:34 -0800 |
commit | fbef44de596d298dc6430f482dffc933a046dd28 (patch) | |
tree | 57345e86b7dda80b82a263069230b7e312db5ef2 /runtime/class_linker_test.cc | |
parent | 603104b5b5c3759b0bc2733bda2f972686a775a3 (diff) | |
download | art-fbef44de596d298dc6430f482dffc933a046dd28.tar.gz art-fbef44de596d298dc6430f482dffc933a046dd28.tar.bz2 art-fbef44de596d298dc6430f482dffc933a046dd28.zip |
Use unique_ptr to track ownership of dex files.
Bug: 18809837
Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
Diffstat (limited to 'runtime/class_linker_test.cc')
-rw-r--r-- | runtime/class_linker_test.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc index 4f09460197..6c7c1e2b50 100644 --- a/runtime/class_linker_test.cc +++ b/runtime/class_linker_test.cc @@ -342,28 +342,26 @@ class ClassLinkerTest : public CommonRuntimeTest { } } - void AssertDexFile(const DexFile* dex, mirror::ClassLoader* class_loader) + void AssertDexFile(const DexFile& dex, mirror::ClassLoader* class_loader) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - ASSERT_TRUE(dex != nullptr); - // Verify all the classes defined in this file - for (size_t i = 0; i < dex->NumClassDefs(); i++) { - const DexFile::ClassDef& class_def = dex->GetClassDef(i); - const char* descriptor = dex->GetClassDescriptor(class_def); + for (size_t i = 0; i < dex.NumClassDefs(); i++) { + const DexFile::ClassDef& class_def = dex.GetClassDef(i); + const char* descriptor = dex.GetClassDescriptor(class_def); AssertDexFileClass(class_loader, descriptor); } // Verify all the types referenced by this file - for (size_t i = 0; i < dex->NumTypeIds(); i++) { - const DexFile::TypeId& type_id = dex->GetTypeId(i); - const char* descriptor = dex->GetTypeDescriptor(type_id); + for (size_t i = 0; i < dex.NumTypeIds(); i++) { + const DexFile::TypeId& type_id = dex.GetTypeId(i); + const char* descriptor = dex.GetTypeDescriptor(type_id); AssertDexFileClass(class_loader, descriptor); } class_linker_->VisitRoots(TestRootVisitor, nullptr, kVisitRootFlagAllRoots); // Verify the dex cache has resolution methods in all resolved method slots - mirror::DexCache* dex_cache = class_linker_->FindDexCache(*dex); + mirror::DexCache* dex_cache = class_linker_->FindDexCache(dex); mirror::ObjectArray<mirror::ArtMethod>* resolved_methods = dex_cache->GetResolvedMethods(); for (size_t i = 0; i < static_cast<size_t>(resolved_methods->GetLength()); i++) { - EXPECT_TRUE(resolved_methods->Get(i) != nullptr) << dex->GetLocation() << " i=" << i; + EXPECT_TRUE(resolved_methods->Get(i) != nullptr) << dex.GetLocation() << " i=" << i; } } @@ -744,7 +742,8 @@ TEST_F(ClassLinkerTest, FindClass) { TEST_F(ClassLinkerTest, LibCore) { ScopedObjectAccess soa(Thread::Current()); - AssertDexFile(java_lang_dex_file_, nullptr); + ASSERT_TRUE(java_lang_dex_file_ != nullptr); + AssertDexFile(*java_lang_dex_file_, nullptr); } // The first reference array element must be a multiple of 4 bytes from the |