pub struct IOCompositor {
painters: Vec<Rc<RefCell<Painter>>>,
shutdown_state: Rc<Cell<ShutdownState>>,
compositor_receiver: RoutedReceiver<CompositorMsg>,
pub(crate) embedder_to_constellation_sender: Sender<EmbedderToConstellationMessage>,
time_profiler_chan: ProfilerChan,
_mem_profiler_registration: ProfilerRegistration,
}Expand description
NB: Never block on the constellation, because sometimes the constellation blocks on us.
Fields§
§painters: Vec<Rc<RefCell<Painter>>>All of the [Painters] for this IOCompositor. Each Painter handles painting to
a single [RenderingContext].
shutdown_state: Rc<Cell<ShutdownState>>Tracks whether we are in the process of shutting down, or have shut down and should close
the compositor. This is shared with the Servo instance.
compositor_receiver: RoutedReceiver<CompositorMsg>The port on which we receive messages.
embedder_to_constellation_sender: Sender<EmbedderToConstellationMessage>The channel on which messages can be sent to the constellation.
time_profiler_chan: ProfilerChanThe channel on which messages can be sent to the time profiler.
_mem_profiler_registration: ProfilerRegistrationA handle to the memory profiler which will automatically unregister when it’s dropped.
Implementations§
Source§impl IOCompositor
impl IOCompositor
pub fn new(state: InitialCompositorState) -> Rc<RefCell<Self>>
pub(crate) fn painter<'a>(&'a self) -> Ref<'a, Painter>
pub(crate) fn painter_mut<'a>(&'a self) -> RefMut<'a, Painter>
pub fn painter_id(&self) -> PainterId
pub fn deinit(&mut self)
pub fn rendering_context_size(&self) -> Size2D<u32, DevicePixel>
pub fn webgl_threads(&self) -> WebGLThreads
pub fn webrender_external_images( &self, ) -> Arc<Mutex<WebRenderExternalImageRegistry>>
pub fn webxr_running(&self) -> bool
pub fn webxr_main_thread_registry(&self) -> Registry
pub fn webgpu_image_map(&self) -> WGPUImageMap
pub fn webviews_needing_repaint(&self) -> Vec<WebViewId>
pub fn finish_shutting_down(&self)
fn handle_browser_message(&self, msg: CompositorMsg)
fn collect_memory_report(&self, sender: ReportsChan)
Sourcefn handle_browser_message_while_shutting_down(&self, msg: CompositorMsg)
fn handle_browser_message_while_shutting_down(&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.
pub fn add_webview( &self, webview: Box<dyn WebViewTrait>, viewport_details: ViewportDetails, )
pub fn show_webview( &self, webview_id: WebViewId, hide_others: bool, ) -> Result<(), UnknownWebView>
pub fn hide_webview(&self, webview_id: WebViewId) -> Result<(), UnknownWebView>
pub fn raise_webview_to_top( &self, webview_id: WebViewId, hide_others: bool, ) -> Result<(), UnknownWebView>
pub fn move_resize_webview(&self, webview_id: WebViewId, rect: DeviceRect)
pub fn set_hidpi_scale_factor( &self, webview_id: WebViewId, new_scale_factor: Scale<f32, DeviceIndependentPixel, DevicePixel>, )
pub fn resize_rendering_context(&self, new_size: PhysicalSize<u32>)
pub fn set_page_zoom(&self, webview_id: WebViewId, new_zoom: f32)
pub fn page_zoom(&self, webview_id: WebViewId) -> f32
Sourcepub fn receiver(&self) -> &RoutedReceiver<CompositorMsg>
pub fn receiver(&self) -> &RoutedReceiver<CompositorMsg>
Get the message receiver for this IOCompositor.
pub fn handle_messages(&self, messages: Vec<CompositorMsg>)
pub fn perform_updates(&self) -> bool
pub fn toggle_webrender_debug(&self, option: WebRenderDebugOption)
pub fn capture_webrender(&self)
pub fn notify_input_event(&self, webview_id: WebViewId, event: InputEventAndId)
pub fn notify_scroll_event( &self, webview_id: WebViewId, scroll: Scroll, point: WebViewPoint, )
pub fn pinch_zoom( &self, webview_id: WebViewId, pinch_zoom_delta: f32, center: DevicePoint, )
pub fn device_pixels_per_page_pixel( &self, webview_id: WebViewId, ) -> Scale<f32, CSSPixel, DevicePixel>
pub(crate) fn shutdown_state(&self) -> ShutdownState
pub fn request_screenshot( &self, webview_id: WebViewId, rect: Option<WebViewRect>, callback: Box<dyn FnOnce(Result<RgbaImage, ScreenshotCaptureError>) + 'static>, )
pub fn notify_input_event_handled( &self, webview_id: WebViewId, input_event_id: InputEventId, result: InputEventResult, )
Auto Trait Implementations§
impl Freeze for IOCompositor
impl !RefUnwindSafe for IOCompositor
impl !Send for IOCompositor
impl !Sync for IOCompositor
impl Unpin for IOCompositor
impl !UnwindSafe for IOCompositor
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> 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