mirror of
https://github.com/servo/servo
synced 2026-05-14 10:56:44 +02:00
This is the last major change before we can try to implement support for multiple windows in Servo. This change makes it so that each `WebView` (via `WebViewBuilder`) takes the `RenderingContext` as an argument, rather than `Servo` (via `ServoBuilder`) as a whole. In the compositor, when registering the `RenderingContext`, if a `Painter` is found for it, it is returned. Otherwise, a new `Painter` (and WebRender instance) is created for it. There is currently no way to unregister a `RenderingContext`. We should come up with a good metric for when is the best time to clean up `Painter`s and WebRender instances for defunct `RenderingContext`s. This could perhaps be done via a `Weak` handle to the `RenderingContext`. Testing: This should not really change observable behavior, so should be covered by existing tests. Fixes: #13995 Closes: #40261 Signed-off-by: Martin Robinson <mrobinson@igalia.com>
59 lines
1.9 KiB
Rust
59 lines
1.9 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
#![deny(unsafe_code)]
|
|
|
|
use std::cell::Cell;
|
|
use std::rc::Rc;
|
|
|
|
use base::generic_channel::RoutedReceiver;
|
|
use compositing_traits::{CompositorMsg, CompositorProxy};
|
|
use constellation_traits::EmbedderToConstellationMessage;
|
|
use crossbeam_channel::Sender;
|
|
use embedder_traits::{EventLoopWaker, ShutdownState};
|
|
use profile_traits::{mem, time};
|
|
#[cfg(feature = "webxr")]
|
|
use webxr::WebXrRegistry;
|
|
|
|
pub use crate::compositor::{IOCompositor, WebRenderDebugOption};
|
|
|
|
#[macro_use]
|
|
mod tracing;
|
|
|
|
mod compositor;
|
|
mod largest_contentful_paint_calculator;
|
|
mod painter;
|
|
mod pinch_zoom;
|
|
mod pipeline_details;
|
|
mod refresh_driver;
|
|
mod render_notifier;
|
|
mod screenshot;
|
|
mod touch;
|
|
mod webrender_external_images;
|
|
mod webview_manager;
|
|
mod webview_renderer;
|
|
|
|
/// Data used to construct a compositor.
|
|
pub struct InitialCompositorState {
|
|
/// A channel to the compositor.
|
|
pub compositor_proxy: CompositorProxy,
|
|
/// A port on which messages inbound to the compositor can be received.
|
|
pub receiver: RoutedReceiver<CompositorMsg>,
|
|
/// A channel to the constellation.
|
|
pub embedder_to_constellation_sender: Sender<EmbedderToConstellationMessage>,
|
|
/// A channel to the time profiler thread.
|
|
pub time_profiler_chan: time::ProfilerChan,
|
|
/// A channel to the memory profiler thread.
|
|
pub mem_profiler_chan: mem::ProfilerChan,
|
|
/// A shared state which tracks whether Servo has started or has finished
|
|
/// shutting down.
|
|
pub shutdown_state: Rc<Cell<ShutdownState>>,
|
|
/// An [`EventLoopWaker`] used in order to wake up the embedder when it is
|
|
/// time to paint.
|
|
pub event_loop_waker: Box<dyn EventLoopWaker>,
|
|
/// If WebXR is enabled, a [`WebXrRegistry`] to register WebXR threads.
|
|
#[cfg(feature = "webxr")]
|
|
pub webxr_registry: Box<dyn WebXrRegistry>,
|
|
}
|