summaryrefslogtreecommitdiff
path: root/tools/hiddenapi/hiddenapi_test.cc
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2023-02-13 12:42:12 +0000
committer David Srbecky <dsrbecky@google.com> 2023-02-21 18:00:00 +0000
commit052f5fb6d28717b7ff236c508f5fb36a7705f662 (patch)
treed148b944857d92cc4ad5666f7139c16b6ba56394 /tools/hiddenapi/hiddenapi_test.cc
parent4184f23701a64e9902ffced803968fcc5601764b (diff)
Refactor DexFileLoader
The first parameter of the Open methods specifies the data source, that we intend to load the dex file(s) from. This creates large number of overloads when multiplied by diversity of the other arguments. Move the data source parameters to the constructor of DexFileLoader. Specifically, the constructor just creates the right DexFileContainer, and the rest of the loader is independent of the data source used. This removes large amount of the overloads as well as large amount of copy-pasted code. Majority of ArtDexFileLoader has been removed. Bug: 266950186 Test: ./art/test.py -b --host --optimizing --64 Change-Id: I6580b49e65441eec93a7e0124be23bd8c859904a
Diffstat (limited to 'tools/hiddenapi/hiddenapi_test.cc')
-rw-r--r--tools/hiddenapi/hiddenapi_test.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/hiddenapi/hiddenapi_test.cc b/tools/hiddenapi/hiddenapi_test.cc
index f408c6663b..36e80c5c23 100644
--- a/tools/hiddenapi/hiddenapi_test.cc
+++ b/tools/hiddenapi/hiddenapi_test.cc
@@ -106,7 +106,6 @@ class HiddenApiTest : public CommonRuntimeTest {
}
std::unique_ptr<const DexFile> OpenDex(const ScratchFile& file) {
- ArtDexFileLoader dex_loader;
std::string error_msg;
File fd(file.GetFilename(), O_RDONLY, /* check_usage= */ false);
@@ -115,9 +114,9 @@ class HiddenApiTest : public CommonRuntimeTest {
UNREACHABLE();
}
- std::unique_ptr<const DexFile> dex_file(dex_loader.OpenDex(
- fd.Release(), /* location= */ file.GetFilename(), /* verify= */ true,
- /* verify_checksum= */ true, /* mmap_shared= */ false, &error_msg));
+ ArtDexFileLoader dex_loader(fd.Release(), file.GetFilename());
+ std::unique_ptr<const DexFile> dex_file(dex_loader.Open(
+ /* verify= */ true, /* verify_checksum= */ true, /* mmap_shared= */ false, &error_msg));
if (dex_file.get() == nullptr) {
LOG(FATAL) << "Open failed for '" << file.GetFilename() << "' " << error_msg;
UNREACHABLE();