Android: Create a WebView::Application object to placate LibWebView

LibWebView uses the Application object in WebContentClient.cpp, so we
need one to exist. It doesn't really do anything, since we never add
processes to it, but it just has to exist.
This commit is contained in:
Alex Studer 2024-07-03 17:31:23 -04:00 committed by Andrew Kaster
parent e02efed2e5
commit 4d97b29866
Notes: sideshowbarker 2024-07-17 06:20:50 +09:00

View File

@ -19,11 +19,13 @@
#include <LibCore/System.h>
#include <LibCore/Timer.h>
#include <LibFileSystem/FileSystem.h>
#include <LibWebView/Application.h>
#include <jni.h>
static ErrorOr<void> extract_tar_archive(String archive_file, ByteString output_directory);
JavaVM* global_vm;
static OwnPtr<WebView::Application> s_application;
static OwnPtr<Core::EventLoop> s_main_event_loop;
static jobject s_java_instance;
static jmethodID s_schedule_event_loop_method;
@ -69,6 +71,11 @@ Java_org_serenityos_ladybird_LadybirdActivity_initNativeCode(JNIEnv* env, jobjec
};
Core::EventLoopManager::install(*event_loop_manager);
s_main_event_loop = make<Core::EventLoop>();
// FIXME: We are not making use of this Application object to track our processes.
// So, right now, the Application's ProcessManager is constantly empty.
// (However, LibWebView depends on an Application object existing, so we do have to actually create one.)
s_application = make<WebView::Application>(0, nullptr);
}
extern "C" JNIEXPORT void JNICALL
@ -84,6 +91,7 @@ Java_org_serenityos_ladybird_LadybirdActivity_disposeNativeCode(JNIEnv* env, job
{
s_main_event_loop = nullptr;
s_schedule_event_loop_method = nullptr;
s_application = nullptr;
env->DeleteGlobalRef(s_java_instance);
delete &Core::EventLoopManager::the();