Skip to main content

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 crossbeam_channel::Sender;
11use embedder_traits::{EventLoopWaker, ShutdownState};
12use paint_api::{PaintMessage, PaintProxy};
13use profile_traits::{mem, time};
14use servo_base::generic_channel::RoutedReceiver;
15use servo_constellation_traits::EmbedderToConstellationMessage;
16
17pub use crate::paint::{Paint, WebRenderDebugOption};
18
19#[macro_use]
20mod tracing;
21
22mod largest_contentful_paint_calculator;
23mod paint;
24mod painter;
25mod pinch_zoom;
26mod pipeline_details;
27mod refresh_driver;
28mod render_notifier;
29mod screenshot;
30mod touch;
31mod web_content_animation;
32mod webrender_external_images;
33mod webview_renderer;
34
35/// Data used to initialize the `Paint` subsystem.
36pub struct InitialPaintState {
37    /// A channel to `Paint`.
38    pub paint_proxy: PaintProxy,
39    /// A port on which messages inbound to `Paint` can be received.
40    pub receiver: RoutedReceiver<PaintMessage>,
41    /// A channel to the constellation.
42    pub embedder_to_constellation_sender: Sender<EmbedderToConstellationMessage>,
43    /// A channel to the time profiler thread.
44    pub time_profiler_chan: time::ProfilerChan,
45    /// A channel to the memory profiler thread.
46    pub mem_profiler_chan: mem::ProfilerChan,
47    /// A shared state which tracks whether Servo has started or has finished
48    /// shutting down.
49    pub shutdown_state: Rc<Cell<ShutdownState>>,
50    /// An [`EventLoopWaker`] used in order to wake up the embedder when it is
51    /// time to paint.
52    pub event_loop_waker: Box<dyn EventLoopWaker>,
53}