summaryrefslogtreecommitdiff
path: root/runtime/class_loader_context.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2021-04-01 14:22:40 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2021-04-15 12:30:01 +0000
commitc8fe6517faf91b45683cddff3c15e08e489e12e9 (patch)
tree10bf664496e680bbae0d22ff7da32dbbb923613f /runtime/class_loader_context.cc
parent0c39de679bc4b647cfeb1c5c94c86d879848aa55 (diff)
Integrate ClassLoaderContext check in OatFileAssistant::GetBestOatFile.
This reduces some code duplication between OatFileManager::OpenDexFilesFromOat and GetDexoptNeeded. It also gives the chance for OatFileAssistant and GetDexoptNeeded to find the real best oat file. Test: test.py Bug: 176960283 Change-Id: Id366aef7a9e91833d8edaea965abda4cfdcd8455
Diffstat (limited to 'runtime/class_loader_context.cc')
-rw-r--r--runtime/class_loader_context.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index b5ce122c95..228b95028a 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -412,7 +412,9 @@ bool ClassLoaderContext::OpenDexFiles(const std::string& classpath_dir,
// no dex files. So that we can distinguish the real failures...
const ArtDexFileLoader dex_file_loader;
std::vector<ClassLoaderInfo*> work_list;
- CHECK(class_loader_chain_ != nullptr);
+ if (class_loader_chain_ == nullptr) {
+ return true;
+ }
work_list.push_back(class_loader_chain_.get());
size_t dex_file_index = 0;
while (!work_list.empty()) {
@@ -1155,7 +1157,9 @@ std::unique_ptr<ClassLoaderContext> ClassLoaderContext::CreateContextForClassLoa
jobjectArray dex_elements) {
ScopedTrace trace(__FUNCTION__);
- CHECK(class_loader != nullptr);
+ if (class_loader == nullptr) {
+ return nullptr;
+ }
ScopedObjectAccess soa(Thread::Current());
StackHandleScope<2> hs(soa.Self());
Handle<mirror::ClassLoader> h_class_loader =