Allow OatFileAssistant::Create to take std::nullopt for the context.
Partially cherry picked from
commit 12f45c41158de6f6737efb102161f86f462d9290.
Bug: 249984283
Test: m test-art-host-gtest-art_runtime_tests
Change-Id: I7ebe2aa745d0da31242034a27f92b24dbdb08740
Merged-In: I7ebe2aa745d0da31242034a27f92b24dbdb08740
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index ce069d2..2d0a150 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -146,6 +146,8 @@
// device. For example, on an arm device, use arm or arm64. An oat file can
// be loaded executable only if the ISA matches the current runtime.
//
+ // context should be the class loader context to check against, or null to skip the check.
+ //
// load_executable should be true if the caller intends to try and load
// executable code for this dex location.
//
@@ -182,7 +184,7 @@
static std::unique_ptr<OatFileAssistant> Create(
const std::string& filename,
const std::string& isa_str,
- const std::string& context_str,
+ const std::optional<std::string>& context_str,
bool load_executable,
bool only_load_trusted_executable,
OatFileAssistantContext* ofa_context,
@@ -523,6 +525,8 @@
std::string dex_location_;
+ // The class loader context to check against, or null representing that the check should be
+ // skipped.
ClassLoaderContext* context_;
// Whether or not the parent directory of the dex file is writable.