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
impl IOCompositor
pub fn new(state: InitialCompositorState, convert_mouse_to_touch: bool) -> Self
pub fn deinit(&mut self)
pub fn rendering_context_size(&self) -> Size2D<u32, DevicePixel>
pub fn webxr_running(&self) -> bool
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.
Sourcepub(crate) fn generate_frame(
&mut self,
transaction: &mut Transaction,
reason: RenderReasons,
)
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.
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 RendererWebView>, 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>)
Sourcefn process_animations(&mut self, force: bool)
fn process_animations(&mut self, force: bool)
If there are any animations running, dispatches appropriate messages to the constellation.
pub fn on_zoom_reset_window_event(&mut self, webview_id: WebViewId)
pub fn on_zoom_window_event( &mut self, webview_id: WebViewId, magnification: f32, )
fn details_for_pipeline( &self, pipeline_id: PipelineId, ) -> Option<&PipelineDetails>
fn animations_or_animation_callbacks_running(&self) -> bool
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.
Sourcefn is_ready_to_paint_image_output(&mut self) -> Result<(), NotReadyToPaint>
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.
Sourcepub fn render(&mut self) -> bool
pub fn render(&mut self) -> bool
Render the WebRender scene to the active RenderingContext
. If successful, trigger
the next round of animations.
Render the WebRender scene to the shared memory, without updating other state of this
IOCompositor
. If succesful return the output image in shared memory.
fn render_inner(&mut self) -> Result<(), UnableToComposite>
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)
pub fn receive_messages(&mut self)
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, )
fn add_font( &mut self, font_key: FontKey, index: u32, data: Arc<IpcSharedMemory>, )
pub fn notify_input_event(&mut self, webview_id: WebViewId, event: InputEvent)
pub fn notify_scroll_event( &mut self, webview_id: WebViewId, scroll_location: ScrollLocation, cursor: DeviceIntPoint, event_type: TouchEventType, )
pub fn on_vsync(&mut self, webview_id: WebViewId)
pub fn set_pinch_zoom(&mut self, webview_id: WebViewId, magnification: f32)
fn webrender_document(&self) -> DocumentId
fn shutdown_state(&self) -> ShutdownState
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