pub struct ChromiumRuntime { /* private fields */ }Expand description
Owns a live Chromium session, its event stream, and the spawned child process.
ChromiumRuntime coordinates shutdown across the cbf session layer and
the OS process, and can optionally install signal handlers that trigger
forced termination on SIGINT or SIGTERM.
Implementations§
Source§impl ChromiumRuntime
impl ChromiumRuntime
Sourcepub fn new(
session: BrowserSession<ChromiumBackend>,
events: EventStream<ChromiumBackend>,
process: ChromiumProcess,
) -> Self
pub fn new( session: BrowserSession<ChromiumBackend>, events: EventStream<ChromiumBackend>, process: ChromiumProcess, ) -> Self
Wraps an already connected session, event stream, and child process into a single runtime owner.
This is typically constructed from the tuple returned by
start_chromium.
Sourcepub fn session(&self) -> &BrowserSession<ChromiumBackend>
pub fn session(&self) -> &BrowserSession<ChromiumBackend>
Returns the owned browser session for issuing commands and obtaining backend handles.
Sourcepub fn events(&self) -> EventStream<ChromiumBackend>
pub fn events(&self) -> EventStream<ChromiumBackend>
Returns a cloned event stream handle for receiving backend events.
Callers commonly move this clone to a dedicated forwarding thread while retaining the runtime itself for lifecycle management.
Sourcepub fn process(&self) -> &ChromiumProcess
pub fn process(&self) -> &ChromiumProcess
Returns a shared reference to the spawned Chromium process handle.
Sourcepub fn process_mut(&mut self) -> &mut ChromiumProcess
pub fn process_mut(&mut self) -> &mut ChromiumProcess
Returns a mutable reference to the spawned Chromium process handle.
This is intended for advanced process-level operations such as waiting for exit or inspecting process state directly.
Sourcepub fn shutdown_state(&self) -> ChromiumRuntimeShutdownState
pub fn shutdown_state(&self) -> ChromiumRuntimeShutdownState
Returns the current runtime shutdown state tracked by the shutdown controller.
Sourcepub fn shutdown_state_reader(&self) -> ChromiumRuntimeShutdownStateReader
pub fn shutdown_state_reader(&self) -> ChromiumRuntimeShutdownStateReader
Returns a cloneable reader that can observe shutdown progress from other threads without borrowing the runtime.
Sourcepub fn install_signal_handlers(&self) -> Result<(), InstallSignalHandlersError>
pub fn install_signal_handlers(&self) -> Result<(), InstallSignalHandlersError>
Installs process-wide SIGINT/SIGTERM handlers that force runtime
shutdown when either signal is received.
Handlers can only be installed once per process. A received signal uses PID-based termination fallback so shutdown can continue even if the normal event-processing path is stalled.
Sourcepub fn shutdown(&mut self, mode: ShutdownMode) -> Result<()>
pub fn shutdown(&mut self, mode: ShutdownMode) -> Result<()>
Starts runtime shutdown using the requested mode and waits for the child process to exit, escalating to OS-level termination if needed.
Repeated calls after shutdown has already started are treated as no-ops.
On drop, the runtime automatically invokes this with
ShutdownMode::Force.