Files
JuiceAgent/src/libagent/callbacks/ClassFileLoadHook.cpp
T
xiaozhou233 5b0a26d49e Refactor: replace eventpp with a small typed event bus
- 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
2026-10-15 20:58:23 +08:00

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);
}