pub struct IOCompositor {
global: Rc<RefCell<ServoRenderer>>,
webview_renderers: WebViewManager<WebViewRenderer>,
needs_repaint: Cell<RepaintReason>,
webrender: Option<Renderer>,
rendering_context: Rc<dyn RenderingContext>,
pending_frames: Cell<usize>,
screenshot_taker: ScreenshotTaker,
_mem_profiler_registration: ProfilerRegistration,
}
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.
webview_renderers: WebViewManager<WebViewRenderer>
Our WebViewRenderer
s, one for every WebView
.
needs_repaint: Cell<RepaintReason>
Tracks whether or not the view needs to be repainted.
webrender: Option<Renderer>
The webrender renderer.
rendering_context: Rc<dyn RenderingContext>
The RenderingContext
instance that webrender targets, which is the viewport.
pending_frames: Cell<usize>
The number of frames pending to receive from WebRender.
screenshot_taker: ScreenshotTaker
A ScreenshotTaker
responsible for handling all screenshot requests.
_mem_profiler_registration: ProfilerRegistration
A handle to the memory profiler which will automatically unregister when it’s dropped.
Implementations§
Source§impl IOCompositor
impl IOCompositor
pub fn new(state: InitialCompositorState) -> Self
pub fn deinit(&mut self)
pub(crate) fn rendering_context(&self) -> &dyn RenderingContext
pub fn rendering_context_size(&self) -> Size2D<u32, DevicePixel>
pub fn webxr_running(&self) -> bool
pub(crate) fn webview_renderer( &self, webview_id: WebViewId, ) -> Option<&WebViewRenderer>
pub(crate) fn set_needs_repaint(&self, reason: RepaintReason)
pub fn needs_repaint(&self) -> bool
pub fn finish_shutting_down(&mut self)
fn handle_browser_message(&mut self, msg: CompositorMsg)
Sourcefn handle_browser_message_while_shutting_down(&mut self, msg: CompositorMsg)
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.
Sourcefn handle_generate_font_keys(
&self,
number_of_font_keys: usize,
number_of_font_instance_keys: usize,
result_sender: GenericSender<(Vec<FontKey>, Vec<FontInstanceKey>)>,
_rendering_group_id: RenderingGroupId,
)
fn handle_generate_font_keys( &self, number_of_font_keys: usize, number_of_font_instance_keys: usize, result_sender: GenericSender<(Vec<FontKey>, Vec<FontInstanceKey>)>, _rendering_group_id: RenderingGroupId, )
Generate the font keys and send them to the result_sender
.
Currently RenderingGroupId
is not used.
Sourcepub(crate) fn generate_frame(
&self,
transaction: &mut Transaction,
reason: RenderReasons,
)
pub(crate) fn generate_frame( &self, transaction: &mut Transaction, reason: RenderReasons, )
Queue a new frame in the transaction and increase the pending frames count.
Sourcefn send_root_pipeline_display_list(&mut self)
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.
Sourcepub(crate) fn send_root_pipeline_display_list_in_transaction(
&self,
transaction: &mut Transaction,
)
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.
Sourcefn update_transaction_with_all_scroll_offsets(
&self,
transaction: &mut Transaction,
)
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?
pub fn add_webview( &mut self, webview: Box<dyn WebViewTrait>, viewport_details: ViewportDetails, )
fn set_frame_tree_for_webview(&mut self, frame_tree: &SendableFrameTree)
fn remove_webview(&mut self, webview_id: WebViewId)
pub fn show_webview( &mut self, webview_id: WebViewId, hide_others: bool, ) -> Result<(), UnknownWebView>
pub fn hide_webview( &mut self, webview_id: WebViewId, ) -> Result<(), UnknownWebView>
pub fn raise_webview_to_top( &mut self, webview_id: WebViewId, hide_others: bool, ) -> Result<(), UnknownWebView>
pub fn move_resize_webview(&mut self, webview_id: WebViewId, rect: DeviceRect)
pub fn set_hidpi_scale_factor( &mut self, webview_id: WebViewId, new_scale_factor: Scale<f32, DeviceIndependentPixel, DevicePixel>, )
pub fn resize_rendering_context(&mut self, new_size: PhysicalSize<u32>)
pub fn on_zoom_window_event(&mut self, webview_id: WebViewId, new_zoom: f32)
Sourcefn animation_callbacks_running(&self) -> bool
fn animation_callbacks_running(&self) -> bool
Returns true if any animation callbacks (ie requestAnimationFrame
) are waiting for a response.
fn render_inner(&mut self)
Sourcefn send_pending_paint_metrics_messages_after_composite(&mut self)
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.
fn clear_background(&self)
fn assert_no_gl_error(&self)
fn assert_gl_framebuffer_complete(&self)
Sourcepub fn receiver(&self) -> Ref<'_, RoutedReceiver<CompositorMsg>>
pub fn receiver(&self) -> Ref<'_, RoutedReceiver<CompositorMsg>>
Get the message receiver for this IOCompositor
.
pub fn handle_messages(&mut self, messages: Vec<CompositorMsg>)
pub fn perform_updates(&mut self) -> bool
pub fn toggle_webrender_debug(&mut self, option: WebRenderDebugOption)
pub fn capture_webrender(&mut self)
fn add_font_instance( &mut self, instance_key: FontInstanceKey, font_key: FontKey, size: f32, flags: FontInstanceFlags, variations: Vec<FontVariation>, )
fn add_font( &mut self, font_key: FontKey, index: u32, data: Arc<IpcSharedMemory>, )
pub fn notify_input_event( &mut self, webview_id: WebViewId, event: InputEventAndId, )
pub fn notify_scroll_event( &mut self, webview_id: WebViewId, scroll_location: ScrollLocation, cursor: DeviceIntPoint, )
pub fn on_vsync(&mut self, webview_id: WebViewId)
pub fn set_pinch_zoom(&mut self, webview_id: WebViewId, magnification: f32)
pub fn device_pixels_per_page_pixel( &self, webview_id: WebViewId, ) -> Scale<f32, CSSPixel, DevicePixel>
fn webrender_document(&self) -> DocumentId
fn shutdown_state(&self) -> ShutdownState
fn refresh_cursor(&self)
fn handle_new_webrender_frame_ready(&mut self, repaint_needed: bool)
Sourcepub(crate) fn has_pending_frames(&self) -> bool
pub(crate) fn has_pending_frames(&self) -> bool
Whether or not the renderer is waiting on a frame, either because it has been sent
to WebRender and is not ready yet or because the FrameDelayer
is delaying a frame
waiting for asynchronous (canvas) image updates to complete.
pub fn request_screenshot( &self, webview_id: WebViewId, rect: Option<DeviceRect>, callback: Box<dyn FnOnce(Result<RgbaImage, ScreenshotCaptureError>) + 'static>, )
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