mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 21:15:56 +08:00
- libagent: rewrite EventBus as a type-safe dispatcher keyed by event type; listeners are invoked with the concrete event type instead of 'const void*', and the bus is mutex-protected - libagent: services subscribe/unsubscribe by event type (IService::listen no longer takes an EventId) - libagent: remove the unused MethodEntry/MethodExit events and EventMethodEntry/EventMethodExit structs - build: drop the in-tree eventpp headers (23 files) and its license
35 lines
995 B
C++
35 lines
995 B
C++
#include <jni_common.hpp>
|
|
#include <eventbus.hpp>
|
|
#include <event/event_type.hpp>
|
|
|
|
void JNICALL ClassFileLoadHook(
|
|
jvmtiEnv* jvmti_env,
|
|
JNIEnv* jni_env,
|
|
jclass class_being_redefined,
|
|
jobject loader,
|
|
const char* name,
|
|
jobject protection_domain,
|
|
jint class_data_len,
|
|
const unsigned char* classbytes,
|
|
jint* new_class_data_len,
|
|
unsigned char** new_classbytes) {
|
|
if (!name) {
|
|
spdlog::warn("[ClassFileLoadHook] name is null");
|
|
return;
|
|
}
|
|
|
|
EventClassFileLoadHook event{
|
|
jvmti_env,
|
|
jni_env,
|
|
class_being_redefined,
|
|
loader,
|
|
name,
|
|
protection_domain,
|
|
class_data_len,
|
|
classbytes,
|
|
new_class_data_len,
|
|
new_classbytes
|
|
};
|
|
|
|
EventBus::getInstance().post(event);
|
|
} |