summaryrefslogtreecommitdiff
path: root/runtime/class_loader_context.h
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2018-04-18 19:13:48 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-04-18 19:13:48 +0000
commit9f3a0c3d5171f49111e11a62b6ff746a7838afe0 (patch)
tree1e649697b1cacdfb2dd771ae59b31273003ab9db /runtime/class_loader_context.h
parentbee0c29a1183e70d67c6e1f8f8e5446d494a6eda (diff)
parent0d6736f8355be80ceb6ab853f8fdad45028f071f (diff)
Merge changes I16fde69b,I6c085137 into pi-dev
* changes: Add arg for overwriting class loader class path Add stored class loader context option
Diffstat (limited to 'runtime/class_loader_context.h')
-rw-r--r--runtime/class_loader_context.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/runtime/class_loader_context.h b/runtime/class_loader_context.h
index 692a6cda5b..1c83007f41 100644
--- a/runtime/class_loader_context.h
+++ b/runtime/class_loader_context.h
@@ -84,9 +84,12 @@ class ClassLoaderContext {
// (so that it can be read and verified at runtime against the actual class
// loader hierarchy).
// Should only be called if OpenDexFiles() returned true.
+ // If stored context is non-null, the stored names are overwritten by the class path from the
+ // stored context.
// E.g. if the context is PCL[a.dex:b.dex] this will return
// "PCL[a.dex*a_checksum*b.dex*a_checksum]".
- std::string EncodeContextForOatFile(const std::string& base_dir) const;
+ std::string EncodeContextForOatFile(const std::string& base_dir,
+ ClassLoaderContext* stored_context = nullptr) const;
// Encodes the context as a string suitable to be passed to dex2oat.
// This is the same as EncodeContextForOatFile but without adding the checksums
@@ -104,7 +107,11 @@ class ClassLoaderContext {
// - the class loader from the same position have the same classpath
// (the order and checksum of the dex files matches)
// This should be called after OpenDexFiles().
- bool VerifyClassLoaderContextMatch(const std::string& context_spec) const;
+ // Names are only verified if verify_names is true.
+ // Checksums are only verified if verify_checksums is true.
+ bool VerifyClassLoaderContextMatch(const std::string& context_spec,
+ bool verify_names = true,
+ bool verify_checksums = true) const;
// Creates the class loader context from the given string.
// The format: ClassLoaderType1[ClasspathElem1:ClasspathElem2...];ClassLoaderType2[...]...
@@ -146,6 +153,8 @@ class ClassLoaderContext {
// The list of class path elements that this loader loads.
// Note that this list may contain relative paths.
std::vector<std::string> classpath;
+ // Original opened class path (ignoring multidex).
+ std::vector<std::string> original_classpath;
// The list of class path elements checksums.
// May be empty if the checksums are not given when the context is created.
std::vector<uint32_t> checksums;
@@ -198,7 +207,9 @@ class ClassLoaderContext {
// location). Otherwise, for oat files, the encoding adds all the dex files (including multidex)
// together with their checksums.
// Should only be called if OpenDexFiles() returned true.
- std::string EncodeContext(const std::string& base_dir, bool for_dex2oat) const;
+ std::string EncodeContext(const std::string& base_dir,
+ bool for_dex2oat,
+ ClassLoaderContext* stored_context) const;
// Extracts the class loader type from the given spec.
// Return ClassLoaderContext::kInvalidClassLoader if the class loader type is not