paint/
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 constellation_traits::EmbedderToConstellationMessage;
12use crossbeam_channel::Sender;
13use embedder_traits::{EventLoopWaker, ShutdownState};
14use paint_api::{PaintMessage, PaintProxy};
15use profile_traits::{mem, time};
16#[cfg(feature = "webxr")]
17use webxr::WebXrRegistry;
18
19pub use crate::paint::{Paint, WebRenderDebugOption};
20
21#[macro_use]
22mod tracing;
23
24mod largest_contentful_paint_calculator;
25mod paint;
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 initialize the `Paint` subsystem.
37pub struct InitialPaintState {
38    /// A channel to `Paint`.
39    pub paint_proxy: PaintProxy,
40    /// A port on which messages inbound to `Paint` can be received.
41    pub receiver: RoutedReceiver<PaintMessage>,
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}