Add ClassPreDefine hook.
This hook is called prior to defining a class for the first time. It
allows callbacks to modify the dex-file used to load the class if they
wish. The event handler is responsible for ensuring that the returned
dex-file is set-up correctly.
Bug: 31684920
Test: mma -j40 test-art-host
Change-Id: Iaed79c1597913148ead795e033a0a10a4ebe6b2b
diff --git a/runtime/runtime_callbacks.h b/runtime/runtime_callbacks.h
index e580e78..d321254 100644
--- a/runtime/runtime_callbacks.h
+++ b/runtime/runtime_callbacks.h
@@ -21,12 +21,14 @@
#include "base/macros.h"
#include "base/mutex.h"
+#include "dex_file.h"
#include "handle.h"
namespace art {
namespace mirror {
class Class;
+class ClassLoader;
} // namespace mirror
class ClassLoadCallback;
@@ -99,6 +101,15 @@
void NextRuntimePhase(RuntimePhaseCallback::RuntimePhase phase)
REQUIRES_SHARED(Locks::mutator_lock_);
+ void ClassPreDefine(const char* descriptor,
+ Handle<mirror::Class> temp_class,
+ Handle<mirror::ClassLoader> loader,
+ const DexFile& initial_dex_file,
+ const DexFile::ClassDef& initial_class_def,
+ /*out*/DexFile const** final_dex_file,
+ /*out*/DexFile::ClassDef const** final_class_def)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+
private:
std::vector<ThreadLifecycleCallback*> thread_callbacks_
GUARDED_BY(Locks::mutator_lock_);