Factor out code for picking the best oat file.
Factor out common code for determining the best oat file.
Bug: 30937355
Test: oat_file_assistant_test
Change-Id: Ic32af2ec493675be1a22e81c2de46a848c398f6b
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index 2369ed0..14bd82f 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -294,7 +294,11 @@
// Initially the info is for no file in particular. It will treat the
// file as out of date until Reset is called with a real filename to use
// the cache for.
- explicit OatFileInfo(OatFileAssistant* oat_file_assistant);
+ // Pass true for is_oat_location if the information associated with this
+ // OatFileInfo is for the oat location, as opposed to the odex location.
+ OatFileInfo(OatFileAssistant* oat_file_assistant, bool is_oat_location);
+
+ bool IsOatLocation();
const std::string* Filename();
bool Exists();
@@ -356,8 +360,8 @@
// the OatFileInfo object.
std::unique_ptr<OatFile> ReleaseFile();
- private:
OatFileAssistant* oat_file_assistant_;
+ const bool is_oat_location_;
bool filename_provided_ = false;
std::string filename_;
@@ -374,6 +378,9 @@
bool file_released_ = false;
};
+ // Return info for the best oat file.
+ OatFileInfo& GetBestInfo();
+
// Returns the current image location.
// Returns an empty string if the image location could not be retrieved.
//