mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-25 01:47:28 +00:00
Ladybird/Android: Bind WebSocketService for WebSocket purposes
Similar to the RequestServer, bind this from the WebContentService implementation and have it work the same way. Deduplicate some code while we're here.
This commit is contained in:
committed by
Andrew Kaster
parent
a243bc465f
commit
ff0494c63b
@@ -11,6 +11,7 @@
|
||||
jobject global_instance;
|
||||
jclass global_class_reference;
|
||||
jmethodID bind_request_server_method;
|
||||
jmethodID bind_web_socket_method;
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_org_serenityos_ladybird_WebContentService_nativeInit(JNIEnv* env, jobject thiz)
|
||||
@@ -27,6 +28,11 @@ Java_org_serenityos_ladybird_WebContentService_nativeInit(JNIEnv* env, jobject t
|
||||
if (!method)
|
||||
TODO();
|
||||
bind_request_server_method = method;
|
||||
|
||||
method = env->GetMethodID(global_class_reference, "bindWebSocket", "(II)V");
|
||||
if (!method)
|
||||
TODO();
|
||||
bind_web_socket_method = method;
|
||||
}
|
||||
|
||||
void bind_request_server_java(int ipc_socket, int fd_passing_socket)
|
||||
@@ -34,3 +40,9 @@ void bind_request_server_java(int ipc_socket, int fd_passing_socket)
|
||||
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);
|
||||
env.get()->CallVoidMethod(global_instance, bind_web_socket_method, ipc_socket, fd_passing_socket);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user