summaryrefslogtreecommitdiffstats
path: root/oatdump
diff options
context:
space:
mode:
authorRichard Uhler <ruhler@google.com>2014-12-23 09:48:51 -0800
committerRichard Uhler <ruhler@google.com>2015-01-13 16:32:34 -0800
commitfbef44de596d298dc6430f482dffc933a046dd28 (patch)
tree57345e86b7dda80b82a263069230b7e312db5ef2 /oatdump
parent603104b5b5c3759b0bc2733bda2f972686a775a3 (diff)
downloadart-fbef44de596d298dc6430f482dffc933a046dd28.zip
art-fbef44de596d298dc6430f482dffc933a046dd28.tar.gz
art-fbef44de596d298dc6430f482dffc933a046dd28.tar.bz2
Use unique_ptr to track ownership of dex files.
Bug: 18809837 Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
Diffstat (limited to 'oatdump')
-rw-r--r--oatdump/oatdump.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index de4ea36..931cca7 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -1968,13 +1968,13 @@ static int DumpOatWithRuntime(Runtime* runtime, OatFile* oat_file, OatDumperOpti
ScopedObjectAccess soa(self);
ClassLinker* class_linker = runtime->GetClassLinker();
class_linker->RegisterOatFile(oat_file);
- std::vector<const DexFile*> dex_files;
+ std::vector<std::unique_ptr<const DexFile>> dex_files;
for (const OatFile::OatDexFile* odf : oat_file->GetOatDexFiles()) {
std::string error_msg;
- const DexFile* dex_file = odf->OpenDexFile(&error_msg);
+ std::unique_ptr<const DexFile> dex_file = odf->OpenDexFile(&error_msg);
CHECK(dex_file != nullptr) << error_msg;
class_linker->RegisterDexFile(*dex_file);
- dex_files.push_back(dex_file);
+ dex_files.push_back(std::move(dex_file));
}
// Need a class loader.
@@ -1983,7 +1983,11 @@ static int DumpOatWithRuntime(Runtime* runtime, OatFile* oat_file, OatDumperOpti
soa.Env()->AllocObject(WellKnownClasses::dalvik_system_PathClassLoader));
jobject class_loader = soa.Env()->NewGlobalRef(class_loader_local.get());
// Fake that we're a compiler.
- runtime->SetCompileTimeClassPath(class_loader, dex_files);
+ std::vector<const DexFile*> class_path;
+ for (auto& dex_file : dex_files) {
+ class_path.push_back(dex_file.get());
+ }
+ runtime->SetCompileTimeClassPath(class_loader, class_path);
// Use the class loader while dumping.
StackHandleScope<1> scope(self);