mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Because there used to be two traits exposing messages to the compositor, there were two kinds of messages that could be sent: 1. In-process messages from the `Constellation` 2. Cross-process messages from other parts of Servo Now these two types of messages can be unified into one type. This is a reland of #36443, which caused regressions due to the fact that messages to the compositor were no longer triggering the event loop waker. This version of the PR splits out just the bits that unify the two APIs, leaving the cleanup of routes in the constellation for another PR. Testing: This is covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
53 lines
1.8 KiB
Rust
53 lines
1.8 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 compositing_traits::rendering_context::RenderingContext;
|
|
use compositing_traits::{CompositorMsg, CompositorProxy};
|
|
use constellation_traits::EmbedderToConstellationMessage;
|
|
use crossbeam_channel::{Receiver, Sender};
|
|
use embedder_traits::ShutdownState;
|
|
use profile_traits::{mem, time};
|
|
use webrender::RenderApi;
|
|
use webrender_api::DocumentId;
|
|
|
|
pub use crate::compositor::IOCompositor;
|
|
|
|
#[macro_use]
|
|
mod tracing;
|
|
|
|
mod compositor;
|
|
mod touch;
|
|
pub mod webview;
|
|
pub mod webview_manager;
|
|
pub mod windowing;
|
|
|
|
/// Data used to construct a compositor.
|
|
pub struct InitialCompositorState {
|
|
/// A channel to the compositor.
|
|
pub sender: CompositorProxy,
|
|
/// A port on which messages inbound to the compositor can be received.
|
|
pub receiver: Receiver<CompositorMsg>,
|
|
/// A channel to the constellation.
|
|
pub constellation_chan: 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>>,
|
|
/// Instance of webrender API
|
|
pub webrender: webrender::Renderer,
|
|
pub webrender_document: DocumentId,
|
|
pub webrender_api: RenderApi,
|
|
pub rendering_context: Rc<dyn RenderingContext>,
|
|
pub webrender_gl: Rc<dyn gleam::gl::Gl>,
|
|
#[cfg(feature = "webxr")]
|
|
pub webxr_main_thread: webxr::MainThreadRegistry,
|
|
}
|