Struct servo::Servo

source ·
pub struct Servo<Window: WindowMethods + 'static + ?Sized> {
    pub(crate) compositor: IOCompositor<Window>,
    pub(crate) constellation_chan: Sender<ConstellationMsg>,
    pub(crate) embedder_receiver: EmbedderReceiver,
    pub(crate) messages_for_embedder: Vec<(Option<TopLevelBrowsingContextId>, EmbedderMsg)>,
    pub(crate) profiler_enabled: bool,
    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§

§compositor: IOCompositor<Window>§constellation_chan: Sender<ConstellationMsg>§embedder_receiver: EmbedderReceiver§messages_for_embedder: Vec<(Option<TopLevelBrowsingContextId>, EmbedderMsg)>§profiler_enabled: bool§_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<Window> Servo<Window>
where Window: WindowMethods + 'static + ?Sized,

source

pub fn new( embedder: Box<dyn EmbedderMethods>, window: Rc<Window>, user_agent: Option<String>, composite_target: CompositeTarget, ) -> InitializedServo<Window>

source

pub(crate) fn get_native_media_display_and_gl_context( rendering_context: &RenderingContext, ) -> Option<(NativeDisplay, GlContext)>

source

pub(crate) fn create_media_window_gl_context( external_image_handlers: &mut WebrenderExternalImageHandlers, external_images: Arc<Mutex<WebrenderExternalImageRegistry>>, rendering_context: &RenderingContext, ) -> (WindowGLContext, Option<GLPlayerThreads>)

source

pub(crate) fn handle_window_event(&mut self, event: EmbedderEvent) -> bool

source

pub(crate) fn send_to_constellation(&self, msg: ConstellationMsg)

source

pub(crate) fn receive_messages(&mut self)

source

pub fn get_events( &mut self, ) -> Drain<'_, (Option<TopLevelBrowsingContextId>, EmbedderMsg)>

source

pub fn handle_events( &mut self, events: impl IntoIterator<Item = EmbedderEvent>, ) -> bool

source

pub fn repaint_synchronously(&mut self)

source

pub fn pinch_zoom_level(&self) -> f32

source

pub fn setup_logging(&self)

source

pub fn window(&self) -> &Window

source

pub fn deinit(self)

source

pub fn present(&mut self)

source

pub fn offscreen_framebuffer_id(&self) -> Option<u32>

Return the OpenGL framebuffer name of the most-recently-completed frame when compositing to CompositeTarget::Fbo, or None otherwise.

Auto Trait Implementations§

§

impl<Window> !Freeze for Servo<Window>

§

impl<Window> !RefUnwindSafe for Servo<Window>

§

impl<Window> !Send for Servo<Window>

§

impl<Window> !Sync for Servo<Window>

§

impl<Window> Unpin for Servo<Window>
where Window: ?Sized,

§

impl<Window> !UnwindSafe for Servo<Window>

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> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> Filterable for T

source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

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> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T