mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
Feat: Event of preload & loaded
This commit is contained in:
1 parent
eb3a76769d
commit
f8be8cb795
2 files changed
+29
No files matched your search
@@ -1,6 +1,8 @@
|
||||
#include <libagent.hpp>
|
||||
#include <jni_impl.hpp>
|
||||
#include <bytecodes_opt.hpp>
|
||||
#include <event/event_type.hpp>
|
||||
#include <event/eventbus.hpp>
|
||||
|
||||
namespace JuiceAgent {
|
||||
// ===== Singleton =====
|
||||
@@ -12,6 +14,13 @@ namespace JuiceAgent {
|
||||
bool Agent::init(JavaVM* jvm, JNIEnv* env, jvmtiEnv* jvmti) {
|
||||
PLOGI << "JuiceAgent Native EntryPoint Invoked!";
|
||||
|
||||
// PreLoad Event
|
||||
eventbus.post(EventPreLoad{
|
||||
.jvm = jvm,
|
||||
.env = env,
|
||||
.jvmti = jvmti
|
||||
});
|
||||
|
||||
// ======== neccessary environment check ========
|
||||
if (jvm == nullptr) {
|
||||
PLOGE << "Failed to initialize JuiceAgent: jvm is null";
|
||||
@@ -64,6 +73,13 @@ namespace JuiceAgent {
|
||||
// register bytecodes_opt
|
||||
JuiceAgent::Bytecodes::register_bytecodes();
|
||||
|
||||
|
||||
// Loaded Event
|
||||
eventbus.post(EventLoaded{
|
||||
.jvm = jvm,
|
||||
.env = env,
|
||||
.jvmti = jvmti
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user