Skip to main content

ChromiumRuntime

Struct ChromiumRuntime 

Source
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

Source

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.

Source

pub fn session(&self) -> &BrowserSession<ChromiumBackend>

Returns the owned browser session for issuing commands and obtaining backend handles.

Source

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.

Source

pub fn process(&self) -> &ChromiumProcess

Returns a shared reference to the spawned Chromium process handle.

Source

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.

Source

pub fn shutdown_state(&self) -> ChromiumRuntimeShutdownState

Returns the current runtime shutdown state tracked by the shutdown controller.

Source

pub fn shutdown_state_reader(&self) -> ChromiumRuntimeShutdownStateReader

Returns a cloneable reader that can observe shutdown progress from other threads without borrowing the runtime.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for ChromiumRuntime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for ChromiumRuntime

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,