diff options
| author | 2016-08-12 09:05:13 -0700 | |
|---|---|---|
| committer | 2016-08-12 12:45:05 -0700 | |
| commit | 55b58b6b68727ac714ed5ce2ff2f45a33caf9368 (patch) | |
| tree | d4d02eedf7a0cb92d99e27ddae6eca2eac788692 /runtime/oat_file_assistant.cc | |
| parent | 066187de25e3fd2ae86bad812f514e16793caae7 (diff) | |
Clean up use of GetDalvikCache.
Switch the only caller of the non-void version of GetDalvikCache that set
create_if_absent true to use the void version of GetDalvikCache. Then no
callers of the non-void version of GetDalvikCache set create_if_absent to
true, so that argument is no longer needed. And without create_if_absent,
there is no case when the function will abort, so the 'OrDie" option is no
longer necessary.
Change-Id: I83f60dcc8a8f3b1f91fd2971e9028f6a7dd8384d
Test: m art-test-host
Test: m art-test-target
Diffstat (limited to 'runtime/oat_file_assistant.cc')
| -rw-r--r-- | runtime/oat_file_assistant.cc | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc index 2c2a2b85a5..0abee42cb1 100644 --- a/runtime/oat_file_assistant.cc +++ b/runtime/oat_file_assistant.cc @@ -713,21 +713,15 @@ bool OatFileAssistant::DexLocationToOatFilename(const std::string& location, CHECK(oat_filename != nullptr); CHECK(error_msg != nullptr); - // TODO: The work done in GetDalvikCache is overkill for what we need. - // Ideally a new API for getting the DalvikCacheDirectory the way we want - // (without existence testing, creation, or death) is provided with the rest - // of the GetDalvikCache family of functions. Until such an API is in place, - // we use GetDalvikCache to avoid duplicating the logic for determining the - // dalvik cache directory. - std::string dalvik_cache_dir; - bool ignored; - GetDalvikCache("", false, &dalvik_cache_dir, &ignored, &ignored, &ignored); + std::string cache_dir = GetDalvikCache(GetInstructionSetString(isa)); + if (cache_dir.empty()) { + *error_msg = "Dalvik cache directory does not exist"; + return false; + } // TODO: The oat file assistant should be the definitive place for // determining the oat file name from the dex location, not // GetDalvikCacheFilename. - std::string cache_dir = StringPrintf("%s%s", - dalvik_cache_dir.c_str(), GetInstructionSetString(isa)); return GetDalvikCacheFilename(location.c_str(), cache_dir.c_str(), oat_filename, error_msg); } |