compositing/
lib.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5#![deny(unsafe_code)]
6
7use std::cell::Cell;
8use std::rc::Rc;
9
10use base::generic_channel::RoutedReceiver;
11use compositing_traits::{CompositorMsg, CompositorProxy};
12use constellation_traits::EmbedderToConstellationMessage;
13use crossbeam_channel::Sender;
14use embedder_traits::{EventLoopWaker, ShutdownState};
15use profile_traits::{mem, time};
16#[cfg(feature = "webxr")]
17use webxr::WebXrRegistry;
18
19pub use crate::compositor::{IOCompositor, WebRenderDebugOption};
20
21#[macro_use]
22mod tracing;
23
24mod compositor;
25mod largest_contentful_paint_calculator;
26mod painter;
27mod pinch_zoom;
28mod pipeline_details;
29mod refresh_driver;
30mod render_notifier;
31mod screenshot;
32mod touch;
33mod webrender_external_images;
34mod webview_renderer;
35
36/// Data used to construct a compositor.
37pub struct InitialCompositorState {
38    /// A channel to the compositor.
39    pub compositor_proxy: CompositorProxy,
40    /// A port on which messages inbound to the compositor can be received.
41    pub receiver: RoutedReceiver<CompositorMsg>,
42    /// A channel to the constellation.
43    pub embedder_to_constellation_sender: Sender<EmbedderToConstellationMessage>,
44    /// A channel to the time profiler thread.
45    pub time_profiler_chan: time::ProfilerChan,
46    /// A channel to the memory profiler thread.
47    pub mem_profiler_chan: mem::ProfilerChan,
48    /// A shared state which tracks whether Servo has started or has finished
49    /// shutting down.
50    pub shutdown_state: Rc<Cell<ShutdownState>>,
51    /// An [`EventLoopWaker`] used in order to wake up the embedder when it is
52    /// time to paint.
53    pub event_loop_waker: Box<dyn EventLoopWaker>,
54    /// If WebXR is enabled, a [`WebXrRegistry`] to register WebXR threads.
55    #[cfg(feature = "webxr")]
56    pub webxr_registry: Box<dyn WebXrRegistry>,
57}