Skip to main content

Module runtime

Module runtime 

Source
Expand description

Engine thread + channel bridge.

WebKit on either platform must be driven from the thread that owns its run loop (GMainLoop on Linux, CFRunLoop on macOS). The daemon’s Tokio workers can not call WebKit directly. EngineRuntime owns a dedicated OS thread, lets the platform construct the engine on that thread, and dispatches every call from the daemon over an mpsc channel.

Every wrapper method on EngineRuntime (e.g. EngineRuntime::open) is synchronous and blocks until the engine thread replies. The daemon wraps these in tokio::task::spawn_blocking to keep them off Tokio’s worker threads.

Structs§

EngineRuntime
Owns the engine thread and exposes a synchronous facade.
MainThreadDispatcher
Drives an engine that lives on the caller’'’s thread (typically the OS main thread on macOS, since WKWebView is pinned there). The driver owns the engine and a receiver for jobs sent by the runtime handle that the daemon holds.