Ladybird/Android: Move JavaEnvironment helper to Ladybird namespace

This commit is contained in:
Andrew Kaster 2023-09-23 22:48:24 -06:00 committed by Andrew Kaster
parent b8ede72107
commit a93507231c
Notes: sideshowbarker 2024-07-17 07:25:39 +09:00
3 changed files with 5 additions and 4 deletions

View file

@ -9,6 +9,7 @@
#include <AK/Assertions.h>
#include <jni.h>
namespace Ladybird {
class JavaEnvironment {
public:
JavaEnvironment(JavaVM* vm)
@ -41,5 +42,5 @@ private:
JNIEnv* m_env = nullptr;
bool m_did_attach_thread = false;
};
}
extern JavaVM* global_vm;

View file

@ -64,7 +64,7 @@ Java_org_serenityos_ladybird_LadybirdActivity_initNativeCode(JNIEnv* env, jobjec
auto* event_loop_manager = new Ladybird::ALooperEventLoopManager(timer_service_ref);
event_loop_manager->on_did_post_event = [] {
JavaEnvironment env(global_vm);
Ladybird::JavaEnvironment env(global_vm);
env.get()->CallVoidMethod(s_java_instance, s_schedule_event_loop_method);
};
Core::EventLoopManager::install(*event_loop_manager);

View file

@ -37,12 +37,12 @@ Java_org_serenityos_ladybird_WebContentService_nativeInit(JNIEnv* env, jobject t
void bind_request_server_java(int ipc_socket, int fd_passing_socket)
{
JavaEnvironment env(global_vm);
Ladybird::JavaEnvironment env(global_vm);
env.get()->CallVoidMethod(global_instance, bind_request_server_method, ipc_socket, fd_passing_socket);
}
void bind_web_socket_java(int ipc_socket, int fd_passing_socket)
{
JavaEnvironment env(global_vm);
Ladybird::JavaEnvironment env(global_vm);
env.get()->CallVoidMethod(global_instance, bind_web_socket_method, ipc_socket, fd_passing_socket);
}