ART: Refactor ImageSpace loading

Make the code more straightforward so it is easier to reason
about and extend.

Also change return types to unique pointers so it's clear that
it is the caller's responsibility to free those when necessary.

Bug: 30832951
Test: m test-art-host
Test: device booting
Change-Id: I3216eb702e45357a48af5158dacbe40e79bd1ae9
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index effeabb..3f018dc 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -180,7 +180,7 @@
   std::unique_ptr<OatFile> GetBestOatFile();
 
   // Open and returns an image space associated with the oat file.
-  static gc::space::ImageSpace* OpenImageSpace(const OatFile* oat_file);
+  static std::unique_ptr<gc::space::ImageSpace> OpenImageSpace(const OatFile* oat_file);
 
   // Loads the dex files in the given oat file for the given dex location.
   // The oat file should be up to date for the given dex location.