C API: Add JNI bridge between Java proxy classes and WebKit/WPE GObjects#250
Merged
alexgcastro merged 1 commit intomainfrom Apr 20, 2026
Merged
C API: Add JNI bridge between Java proxy classes and WebKit/WPE GObjects#250alexgcastro merged 1 commit intomainfrom
alexgcastro merged 1 commit intomainfrom
Conversation
293daca to
5fd90f4
Compare
spenap
reviewed
Apr 9, 2026
Collaborator
Author
|
@spenap thanks for the review! |
Add Java proxy wrappers plus JNI mappings for WPEDisplay, WPEToplevel, WPEView, WebKitWebContext, WebKitNetworkSession, WebKitSettings, WebKitCookieManager, WebKitWebsiteDataManager, and WebKitWebView. Each bridged class uses a JNI::TypedClass<T> singleton to register native methods and cache Java method IDs at library load time, avoiding repeated JNI lookups in GLib and async callbacks. JNIMappings initialises all singletons during JNI_OnLoad. WebKitWebView and WebKitWebContext use per-object bridge structs that own the native GObject reference, keep a Java GlobalRef back-reference where needed, and track GLib signal handlers for orderly disconnection on destruction. Async operations such as cookie-manager queries, website-data clears, and evaluateJavascript() keep callback holders alive with heap-allocated GlobalRef<T> objects released when the callback runs. WPEToplevelAndroid updates its SurfaceControl tree as native windows are attached and detached, and treats repeated set_window() calls for the same ANativeWindow as a size resync instead of rebuilding the layer tree. Native callbacks may arrive off the main thread; Java-side listener and async result delivery is reposted to the main looper before application-facing callback code runs.
5fd90f4 to
a70f4cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Java proxy wrappers plus JNI mappings for WPEDisplay, WPEToplevel, WPEView, WebKitWebContext, WebKitNetworkSession, WebKitSettings, WebKitCookieManager, WebKitWebsiteDataManager, and WebKitWebView.
Each bridged class uses a JNI::TypedClass singleton to register native methods and cache Java method IDs at library load time, avoiding repeated JNI lookups in GLib and async callbacks. JNIMappings initialises all singletons during JNI_OnLoad.
WebKitWebView and WebKitWebContext use per-object bridge structs that own the native GObject reference, keep a Java GlobalRef back-reference where needed, and track GLib signal handlers for orderly disconnection on destruction. Async operations such as cookie-manager queries, website-data clears, and evaluateJavascript() keep callback holders alive with heap-allocated GlobalRef objects released when the callback runs.
WPEToplevelAndroid updates its SurfaceControl tree as native windows are attached and detached, and treats repeated set_window() calls for the same ANativeWindow as a size resync instead of rebuilding the layer tree.
Native callbacks may arrive off the main thread; Java-side listener and async result delivery is reposted to the main looper before application-facing callback code runs.