diff options
| author | 2018-11-28 00:25:18 +0000 | |
|---|---|---|
| committer | 2018-12-13 17:58:22 +0000 | |
| commit | 785c987bb1e66d6ddce662b61c0fbd094195b022 (patch) | |
| tree | 325f4c3212d0c4be96e3f09a157e183dbafc2813 | |
| parent | c2f685a64f819193fb563d33924d233872b8970a (diff) | |
Plumb through the container as an optional arg to DexFileLoader::Open.
Test: make
Test: device boot
Bug: 119632407
Change-Id: I27727806f1dd52ce22b3f4d1b0ffb57e3ab6269d
| -rw-r--r-- | libdexfile/dex/art_dex_file_loader.cc | 20 | ||||
| -rw-r--r-- | libdexfile/dex/art_dex_file_loader.h | 18 | ||||
| -rw-r--r-- | libdexfile/dex/dex_file_loader.cc | 20 | ||||
| -rw-r--r-- | libdexfile/dex/dex_file_loader.h | 18 |
4 files changed, 42 insertions, 34 deletions
diff --git a/libdexfile/dex/art_dex_file_loader.cc b/libdexfile/dex/art_dex_file_loader.cc index 20a519bf99..ae1322d059 100644 --- a/libdexfile/dex/art_dex_file_loader.cc +++ b/libdexfile/dex/art_dex_file_loader.cc @@ -156,14 +156,16 @@ bool ArtDexFileLoader::GetMultiDexChecksums(const char* filename, return false; } -std::unique_ptr<const DexFile> ArtDexFileLoader::Open(const uint8_t* base, - size_t size, - const std::string& location, - uint32_t location_checksum, - const OatDexFile* oat_dex_file, - bool verify, - bool verify_checksum, - std::string* error_msg) const { +std::unique_ptr<const DexFile> ArtDexFileLoader::Open( + const uint8_t* base, + size_t size, + const std::string& location, + uint32_t location_checksum, + const OatDexFile* oat_dex_file, + bool verify, + bool verify_checksum, + std::string* error_msg, + std::unique_ptr<DexFileContainer> container) const { ScopedTrace trace(std::string("Open dex file from RAM ") + location); return OpenCommon(base, size, @@ -175,7 +177,7 @@ std::unique_ptr<const DexFile> ArtDexFileLoader::Open(const uint8_t* base, verify, verify_checksum, error_msg, - /*container=*/ nullptr, + std::move(container), /*verify_result=*/ nullptr); } diff --git a/libdexfile/dex/art_dex_file_loader.h b/libdexfile/dex/art_dex_file_loader.h index 40d4673625..d41eac5329 100644 --- a/libdexfile/dex/art_dex_file_loader.h +++ b/libdexfile/dex/art_dex_file_loader.h @@ -54,14 +54,16 @@ class ArtDexFileLoader : public DexFileLoader { bool* only_contains_uncompressed_dex = nullptr) const override; // Opens .dex file, backed by existing memory - std::unique_ptr<const DexFile> Open(const uint8_t* base, - size_t size, - const std::string& location, - uint32_t location_checksum, - const OatDexFile* oat_dex_file, - bool verify, - bool verify_checksum, - std::string* error_msg) const override; + std::unique_ptr<const DexFile> Open( + const uint8_t* base, + size_t size, + const std::string& location, + uint32_t location_checksum, + const OatDexFile* oat_dex_file, + bool verify, + bool verify_checksum, + std::string* error_msg, + std::unique_ptr<DexFileContainer> container = nullptr) const override; // Opens .dex file that has been memory-mapped by the caller. std::unique_ptr<const DexFile> Open(const std::string& location, diff --git a/libdexfile/dex/dex_file_loader.cc b/libdexfile/dex/dex_file_loader.cc index 3667c8c289..1884bcf3f8 100644 --- a/libdexfile/dex/dex_file_loader.cc +++ b/libdexfile/dex/dex_file_loader.cc @@ -212,14 +212,16 @@ bool DexFileLoader::GetMultiDexChecksums( return false; } -std::unique_ptr<const DexFile> DexFileLoader::Open(const uint8_t* base, - size_t size, - const std::string& location, - uint32_t location_checksum, - const OatDexFile* oat_dex_file, - bool verify, - bool verify_checksum, - std::string* error_msg) const { +std::unique_ptr<const DexFile> DexFileLoader::Open( + const uint8_t* base, + size_t size, + const std::string& location, + uint32_t location_checksum, + const OatDexFile* oat_dex_file, + bool verify, + bool verify_checksum, + std::string* error_msg, + std::unique_ptr<DexFileContainer> container) const { return OpenCommon(base, size, /*data_base=*/ nullptr, @@ -230,7 +232,7 @@ std::unique_ptr<const DexFile> DexFileLoader::Open(const uint8_t* base, verify, verify_checksum, error_msg, - /*container=*/ nullptr, + std::move(container), /*verify_result=*/ nullptr); } diff --git a/libdexfile/dex/dex_file_loader.h b/libdexfile/dex/dex_file_loader.h index 8fc836e0f5..49e177fce6 100644 --- a/libdexfile/dex/dex_file_loader.h +++ b/libdexfile/dex/dex_file_loader.h @@ -121,14 +121,16 @@ class DexFileLoader { bool* zip_file_only_contains_uncompress_dex = nullptr) const; // Opens .dex file, backed by existing memory - virtual std::unique_ptr<const DexFile> Open(const uint8_t* base, - size_t size, - const std::string& location, - uint32_t location_checksum, - const OatDexFile* oat_dex_file, - bool verify, - bool verify_checksum, - std::string* error_msg) const; + virtual std::unique_ptr<const DexFile> Open( + const uint8_t* base, + size_t size, + const std::string& location, + uint32_t location_checksum, + const OatDexFile* oat_dex_file, + bool verify, + bool verify_checksum, + std::string* error_msg, + std::unique_ptr<DexFileContainer> container = nullptr) const; // Open a dex file with a separate data section. virtual std::unique_ptr<const DexFile> OpenWithDataSection( |