compositing

Struct IOCompositor

Source
pub struct IOCompositor {
    global: Rc<RefCell<ServoRenderer>>,
    webviews: WebViewManager<WebView>,
    needs_repaint: Cell<RepaintReason>,
    ready_to_save_state: ReadyState,
    webrender: Option<Renderer>,
    rendering_context: Rc<dyn RenderingContext>,
    pending_frames: usize,
    last_animation_tick: Instant,
}
Expand description

NB: Never block on the constellation, because sometimes the constellation blocks on us.

Fields§

§global: Rc<RefCell<ServoRenderer>>

Data that is shared by all WebView renderers.

§webviews: WebViewManager<WebView>

Our top-level browsing contexts.

§needs_repaint: Cell<RepaintReason>

Tracks whether or not the view needs to be repainted.

§ready_to_save_state: ReadyState

Used by the logic that determines when it is safe to output an image for the reftest framework.

§webrender: Option<Renderer>

The webrender renderer.

§rendering_context: Rc<dyn RenderingContext>

The surfman instance that webrender targets

§pending_frames: usize

The number of frames pending to receive from WebRender.

§last_animation_tick: Instant

The Instant of the last animation tick, used to avoid flooding the Constellation and ScriptThread with a deluge of animation ticks.

Implementations§

Source§

impl IOCompositor

Source

pub fn new(state: InitialCompositorState, convert_mouse_to_touch: bool) -> Self

Source

pub fn deinit(&mut self)

Source

pub fn rendering_context_size(&self) -> Size2D<u32, DevicePixel>

Source

pub fn webxr_running(&self) -> bool

Source

fn set_needs_repaint(&self, reason: RepaintReason)

Source

pub fn needs_repaint(&self) -> bool

Source

pub fn finish_shutting_down(&mut self)

Source

fn handle_browser_message(&mut self, msg: CompositorMsg)

Source

fn handle_browser_message_while_shutting_down(&mut self, msg: CompositorMsg)

Handle messages sent to the compositor during the shutdown process. In general, the things the compositor can do in this state are limited. It’s very important to answer any synchronous messages though as other threads might be waiting on the results to finish their own shut down process. We try to do as little as possible during this time.

When that involves generating WebRender ids, our approach here is to simply generate them, but assume they will never be used, since once shutting down the compositor no longer does any WebRender frame generation.

Source

pub(crate) fn generate_frame( &mut self, transaction: &mut Transaction, reason: RenderReasons, )

Queue a new frame in the transaction and increase the pending frames count.

Source

fn send_root_pipeline_display_list(&mut self)

Set the root pipeline for our WebRender scene to a display list that consists of an iframe for each visible top-level browsing context, applying a transformation on the root for pinch zoom, page zoom, and HiDPI scaling.

Source

pub(crate) fn send_root_pipeline_display_list_in_transaction( &self, transaction: &mut Transaction, )

Set the root pipeline for our WebRender scene to a display list that consists of an iframe for each visible top-level browsing context, applying a transformation on the root for pinch zoom, page zoom, and HiDPI scaling.

Source

fn update_transaction_with_all_scroll_offsets( &self, transaction: &mut Transaction, )

Update the given transaction with the scroll offsets of all active scroll nodes in the WebRender scene. This is necessary because WebRender does not preserve scroll offsets between scroll tree modifications. If a display list could potentially modify a scroll tree branch, WebRender needs to have scroll offsets for that branch.

TODO(mrobinson): Could we only send offsets for the branch being modified and not the entire scene?

Source

pub fn add_webview( &mut self, webview: Box<dyn RendererWebView>, viewport_details: ViewportDetails, )

Source

fn set_frame_tree_for_webview(&mut self, frame_tree: &SendableFrameTree)

Source

fn remove_webview(&mut self, webview_id: WebViewId)

Source

pub fn show_webview( &mut self, webview_id: WebViewId, hide_others: bool, ) -> Result<(), UnknownWebView>

Source

pub fn hide_webview( &mut self, webview_id: WebViewId, ) -> Result<(), UnknownWebView>

Source

pub fn raise_webview_to_top( &mut self, webview_id: WebViewId, hide_others: bool, ) -> Result<(), UnknownWebView>

Source

pub fn move_resize_webview(&mut self, webview_id: WebViewId, rect: DeviceRect)

Source

pub fn set_hidpi_scale_factor( &mut self, webview_id: WebViewId, new_scale_factor: Scale<f32, DeviceIndependentPixel, DevicePixel>, )

Source

pub fn resize_rendering_context(&mut self, new_size: PhysicalSize<u32>)

Source

fn process_animations(&mut self, force: bool)

If there are any animations running, dispatches appropriate messages to the constellation.

Source

pub fn on_zoom_reset_window_event(&mut self, webview_id: WebViewId)

Source

pub fn on_zoom_window_event( &mut self, webview_id: WebViewId, magnification: f32, )

Source

fn details_for_pipeline( &self, pipeline_id: PipelineId, ) -> Option<&PipelineDetails>

Source

fn animations_or_animation_callbacks_running(&self) -> bool

Source

fn animation_callbacks_running(&self) -> bool

Returns true if any animation callbacks (ie requestAnimationFrame) are waiting for a response.

Source

fn is_ready_to_paint_image_output(&mut self) -> Result<(), NotReadyToPaint>

Query the constellation to see if the current compositor output matches the current frame tree output, and if the associated script threads are idle.

Source

pub fn render(&mut self) -> bool

Render the WebRender scene to the active RenderingContext. If successful, trigger the next round of animations.

Source

fn render_to_shared_memory( &mut self, webview_id: WebViewId, page_rect: Option<Rect<f32, CSSPixel>>, ) -> Result<Option<Image>, UnableToComposite>

Render the WebRender scene to the shared memory, without updating other state of this IOCompositor. If succesful return the output image in shared memory.

Source

fn render_inner(&mut self) -> Result<(), UnableToComposite>

Source

fn send_pending_paint_metrics_messages_after_composite(&mut self)

Send all pending paint metrics messages after a composite operation, which may advance the epoch for pipelines in the WebRender scene.

If there are pending paint metrics, we check if any of the painted epochs is one of the ones that the paint metrics recorder is expecting. In that case, we get the current time, inform the constellation about it and remove the pending metric from the list.

Source

fn clear_background(&self)

Source

fn assert_no_gl_error(&self)

Source

fn assert_gl_framebuffer_complete(&self)

Source

pub fn receive_messages(&mut self)

Source

pub fn perform_updates(&mut self) -> bool

Source

pub fn toggle_webrender_debug(&mut self, option: WebRenderDebugOption)

Source

pub fn capture_webrender(&mut self)

Source

fn add_font_instance( &mut self, instance_key: FontInstanceKey, font_key: FontKey, size: f32, flags: FontInstanceFlags, )

Source

fn add_font( &mut self, font_key: FontKey, index: u32, data: Arc<IpcSharedMemory>, )

Source

pub fn notify_input_event(&mut self, webview_id: WebViewId, event: InputEvent)

Source

pub fn notify_scroll_event( &mut self, webview_id: WebViewId, scroll_location: ScrollLocation, cursor: DeviceIntPoint, event_type: TouchEventType, )

Source

pub fn on_vsync(&mut self, webview_id: WebViewId)

Source

pub fn set_pinch_zoom(&mut self, webview_id: WebViewId, magnification: f32)

Source

fn webrender_document(&self) -> DocumentId

Source

fn shutdown_state(&self) -> ShutdownState

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

Source§

fn downcast(&self) -> &T

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.
Source§

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

Source§

type Output = T

Should always be Self
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> 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