summaryrefslogtreecommitdiff
path: root/runtime/class_loader_context.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-10-10 11:54:29 -0700
committer Mathieu Chartier <mathieuc@google.com> 2017-10-11 14:47:06 -0700
commit79c87da9d4698ec58ece65af0065eebd55a1cfe0 (patch)
tree399797f37712da9d20829d5b5059b6c84943cb02 /runtime/class_loader_context.cc
parent656e97f949df4081fba908113406b32915174502 (diff)
Add DexFileLoader class
Added DexFileLoader class, moved functionality from DexFile there: - Multidex loading logic - DexFile opening logic for Zip and etc - Some other helpers Bug: 63756964 Test: test-art-host Change-Id: Ic3dfa458947d4b69912dea5cdd836e7e8f55061c
Diffstat (limited to 'runtime/class_loader_context.cc')
-rw-r--r--runtime/class_loader_context.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index 2282da048f..167533d68a 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -25,6 +25,7 @@
#include "class_linker.h"
#include "class_loader_utils.h"
#include "dex_file.h"
+#include "dex_file_loader.h"
#include "handle_scope-inl.h"
#include "jni_internal.h"
#include "oat_file_assistant.h"
@@ -227,11 +228,11 @@ bool ClassLoaderContext::OpenDexFiles(InstructionSet isa, const std::string& cla
std::string error_msg;
// When opening the dex files from the context we expect their checksum to match their
// contents. So pass true to verify_checksum.
- if (!DexFile::Open(location.c_str(),
- location.c_str(),
- /*verify_checksum*/ true,
- &error_msg,
- &info.opened_dex_files)) {
+ if (!DexFileLoader::Open(location.c_str(),
+ location.c_str(),
+ /*verify_checksum*/ true,
+ &error_msg,
+ &info.opened_dex_files)) {
// If we fail to open the dex file because it's been stripped, try to open the dex file
// from its corresponding oat file.
// This could happen when we need to recompile a pre-build whose dex code has been stripped.
@@ -282,7 +283,7 @@ bool ClassLoaderContext::RemoveLocationsFromClassPaths(
std::set<std::string> canonical_locations;
for (const std::string& location : locations) {
- canonical_locations.insert(DexFile::GetDexCanonicalLocation(location.c_str()));
+ canonical_locations.insert(DexFileLoader::GetDexCanonicalLocation(location.c_str()));
}
bool removed_locations = false;
for (ClassLoaderInfo& info : class_loader_chain_) {
@@ -292,7 +293,7 @@ bool ClassLoaderContext::RemoveLocationsFromClassPaths(
info.classpath.end(),
[canonical_locations](const std::string& location) {
return ContainsElement(canonical_locations,
- DexFile::GetDexCanonicalLocation(location.c_str()));
+ DexFileLoader::GetDexCanonicalLocation(location.c_str()));
});
info.classpath.erase(kept_it, info.classpath.end());
if (initial_size != info.classpath.size()) {
@@ -340,7 +341,8 @@ std::string ClassLoaderContext::EncodeContext(const std::string& base_dir,
if (for_dex2oat) {
// dex2oat only needs the base location. It cannot accept multidex locations.
// So ensure we only add each file once.
- bool new_insert = seen_locations.insert(dex_file->GetBaseLocation()).second;
+ bool new_insert = seen_locations.insert(
+ DexFileLoader::GetBaseLocation(dex_file->GetLocation())).second;
if (!new_insert) {
continue;
}