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>,
}
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.
Clients create a Servo
instance for a given reference-counted type
implementing WindowMethods
, which is the bridge to whatever
application Servo is embedded in. Clients then create an event
loop to pump messages between the embedding application and
various browser components.
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.
Implementations§
Source§impl Servo
impl Servo
pub fn new( opts: Opts, preferences: Preferences, rendering_context: Rc<dyn RenderingContext>, embedder: Box<dyn EmbedderMethods>, window: Rc<dyn WindowMethods>, user_content_manager: UserContentManager, ) -> Self
pub fn delegate(&self) -> Rc<dyn ServoDelegate>
pub fn set_delegate(&self, delegate: Rc<dyn ServoDelegate>)
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 handle_delegate_errors(&self)
pub(crate) fn clean_up_destroyed_webview_handles(&self)
pub fn pinch_zoom_level(&self) -> f32
pub fn setup_logging(&self)
pub fn start_shutting_down(&self)
pub(crate) fn finish_shutting_down(&self)
pub fn deinit(&self)
pub fn new_webview(&self, url: Url) -> WebView
pub fn new_auxiliary_webview(&self) -> WebView
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