mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Ladybird/Android: Move JavaEnvironment helper to Ladybird namespace
This commit is contained in:
parent
b8ede72107
commit
a93507231c
Notes:
sideshowbarker
2024-07-17 07:25:39 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/a93507231c Pull-request: https://github.com/SerenityOS/serenity/pull/21214 Reviewed-by: https://github.com/AtkinsSJ Reviewed-by: https://github.com/bugaevc
3 changed files with 5 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue