summaryrefslogtreecommitdiff
path: root/runtime/oat_file_assistant.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/oat_file_assistant.cc')
-rw-r--r--runtime/oat_file_assistant.cc38
1 files changed, 24 insertions, 14 deletions
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index e8047af952..c58e47a13a 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -340,17 +340,7 @@ bool OatFileAssistant::GetDexOptNeeded(CompilerFilter::Filter target_compiler_fi
return true;
}
DexOptNeeded dexopt_needed = info.GetDexOptNeeded(target_compiler_filter, dexopt_trigger);
- if (info.IsUseable()) {
- if (&info == &dm_for_oat_ || &info == &dm_for_odex_) {
- dexopt_status->location_ = kLocationDm;
- } else if (info.IsOatLocation()) {
- dexopt_status->location_ = kLocationOat;
- } else {
- dexopt_status->location_ = kLocationOdex;
- }
- } else {
- dexopt_status->location_ = kLocationNoneOrError;
- }
+ dexopt_status->location_ = GetLocation(info);
return dexopt_needed != kNoDexOptNeeded;
}
@@ -1316,16 +1306,22 @@ void OatFileAssistant::GetOptimizationStatus(const std::string& filename,
ofa_context);
std::string out_odex_location; // unused
std::string out_odex_status; // unused
- oat_file_assistant.GetOptimizationStatus(
- &out_odex_location, out_compilation_filter, out_compilation_reason, &out_odex_status);
+ Location out_location; // unused
+ oat_file_assistant.GetOptimizationStatus(&out_odex_location,
+ out_compilation_filter,
+ out_compilation_reason,
+ &out_odex_status,
+ &out_location);
}
void OatFileAssistant::GetOptimizationStatus(std::string* out_odex_location,
std::string* out_compilation_filter,
std::string* out_compilation_reason,
- std::string* out_odex_status) {
+ std::string* out_odex_status,
+ Location* out_location) {
OatFileInfo& oat_file_info = GetBestInfo();
const OatFile* oat_file = oat_file_info.GetFile();
+ *out_location = GetLocation(oat_file_info);
if (oat_file == nullptr) {
std::string error_msg;
@@ -1399,4 +1395,18 @@ bool OatFileAssistant::ZipFileOnlyContainsUncompressedDex() {
return zip_file_only_contains_uncompressed_dex_;
}
+OatFileAssistant::Location OatFileAssistant::GetLocation(OatFileInfo& info) {
+ if (info.IsUseable()) {
+ if (&info == &dm_for_oat_ || &info == &dm_for_odex_) {
+ return kLocationDm;
+ } else if (info.IsOatLocation()) {
+ return kLocationOat;
+ } else {
+ return kLocationOdex;
+ }
+ } else {
+ return kLocationNoneOrError;
+ }
+}
+
} // namespace art