pub struct Servo {
pub(crate) delegate: RefCell<Rc<dyn ServoDelegate>>,
pub(crate) compositor: Rc<RefCell<IOCompositor>>,
pub(crate) constellation_proxy: ConstellationProxy,
pub(crate) embedder_receiver: Receiver<EmbedderMsg>,
pub(crate) shutdown_state: Rc<Cell<ShutdownState>>,
pub(crate) webviews: RefCell<HashMap<WebViewId, Weak<RefCell<WebViewInner>>>>,
pub(crate) servo_errors: ServoErrorChannel,
pub(crate) _js_engine_setup: Option<JSEngineSetup>,
pub(crate) animating: Cell<bool>,
}
Expand description
The in-process interface to Servo.
It does everything necessary to render the web, primarily orchestrating the interaction between JavaScript, CSS layout, rendering, and the client window.
Fields§
§delegate: RefCell<Rc<dyn ServoDelegate>>
§compositor: Rc<RefCell<IOCompositor>>
§constellation_proxy: ConstellationProxy
§embedder_receiver: Receiver<EmbedderMsg>
§shutdown_state: Rc<Cell<ShutdownState>>
Tracks whether we are in the process of shutting down, or have shut down.
This is shared with WebView
s and the ServoRenderer
.
webviews: RefCell<HashMap<WebViewId, Weak<RefCell<WebViewInner>>>>
A map WebView
s that are managed by this Servo
instance. These are stored
as Weak
references so that the embedding application can control their lifetime.
When accessed, Servo
will be reponsible for cleaning up the invalid Weak
references.
servo_errors: ServoErrorChannel
§_js_engine_setup: Option<JSEngineSetup>
For single-process Servo instances, this field controls the initialization and deinitialization of the JS Engine. Multiprocess Servo instances have their own instance that exists in the content process instead.
animating: Cell<bool>
Whether or not any WebView in this instance is animating or WebXR is enabled.
Implementations§
Source§impl Servo
impl Servo
pub(crate) fn new(builder: ServoBuilder) -> Self
pub fn delegate(&self) -> Rc<dyn ServoDelegate>
pub fn set_delegate(&self, delegate: Rc<dyn ServoDelegate>)
Sourcepub fn animating(&self) -> bool
pub fn animating(&self) -> bool
Whether or not any WebView
of this Servo instance has animating content, such as a CSS
animation or transition or is running requestAnimationFrame
callbacks. In addition, this
returns true if WebXR content is running. This indicates that the embedding application
should be spinning the Servo event loop on regular intervals in order to trigger animation
updates.
Sourcepub fn initialize_gl_accelerated_media(
display: NativeDisplay,
api: GlApi,
context: GlContext,
)
pub fn initialize_gl_accelerated_media( display: NativeDisplay, api: GlApi, context: GlContext, )
EXPERIMENTAL: Intialize GL accelerated media playback. This currently only works on a limited number
of platforms. This should be run before calling Servo::new
and creating the first WebView
.
Sourcepub fn spin_event_loop(&self) -> bool
pub fn spin_event_loop(&self) -> bool
Spin the Servo event loop, which:
- Performs updates in the compositor, such as queued pinch zoom events
- Runs delebgate methods on all
WebView
s andServo
itself - Maybe update the rendered compositor output, but without swapping buffers.
The return value of this method indicates whether or not Servo, false indicates that Servo has finished shutting down and you should not spin the event loop any longer.
pub(crate) fn send_new_frame_ready_messages(&self)
pub(crate) fn send_animating_changed_messages(&self)
pub(crate) fn handle_delegate_errors(&self)
pub(crate) fn clean_up_destroyed_webview_handles(&self)
pub fn setup_logging(&self)
pub fn start_shutting_down(&self)
pub(crate) fn finish_shutting_down(&self)
pub fn deinit(&self)
pub(crate) fn get_webview_handle(&self, id: WebViewId) -> Option<WebView>
pub(crate) fn handle_embedder_message(&self, message: EmbedderMsg)
Auto Trait Implementations§
impl !Freeze for Servo
impl !RefUnwindSafe for Servo
impl !Send for Servo
impl !Sync for Servo
impl Unpin for Servo
impl !UnwindSafe for Servo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more