Use unique_ptr to track ownership of dex files.
Bug: 18809837
Change-Id: Ie571eae8fc19ee9207390cff5c7e2a38071b126a
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 6461835..6570c5f 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -105,7 +105,7 @@
~ClassLinker();
// Initialize class linker by bootstraping from dex files.
- void InitWithoutImage(const std::vector<const DexFile*>& boot_class_path)
+ void InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> boot_class_path)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Initialize class linker from one or more images.
@@ -324,7 +324,7 @@
// (if multidex) into the given vector.
bool OpenDexFilesFromOat(const char* dex_location, const char* oat_location,
std::vector<std::string>* error_msgs,
- std::vector<const DexFile*>* dex_files)
+ std::vector<std::unique_ptr<const DexFile>>* dex_files)
LOCKS_EXCLUDED(dex_lock_, Locks::mutator_lock_);
// Returns true if the given oat file has the same image checksum as the image it is paired with.
@@ -722,6 +722,7 @@
const void* GetRuntimeQuickGenericJniStub() const;
std::vector<const DexFile*> boot_class_path_;
+ std::vector<std::unique_ptr<const DexFile>> opened_dex_files_;
mutable ReaderWriterMutex dex_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
std::vector<size_t> new_dex_cache_roots_ GUARDED_BY(dex_lock_);