Repository: servo/servo
File: components/constellation/constellation.rs (Rust)

Code before:
    pub(crate) privileged_urls: Vec<ServoUrl>,

    /// The [`ImageCacheFactory`] to use for all `ScriptThread`s when we are running in
    /// single-process mode. In multi-process mode, each process will create its own
    /// [`ImageCacheFactoryImpl`].
    pub(crate) image_cache_factory: Arc<ImageCacheFactoryImpl>,

    /// Pending viewport changes for browsing contexts that are not
    /// yet known to the constellation.
    pending_viewport_changes: HashMap<BrowsingContextId, ViewportDetails>,

    /// Pending screenshot readiness requests. These are collected until the screenshot is
    /// ready to take place, at which point the Constellation informs the renderer that it
    /// can start the process of taking the screenshot.
    screenshot_readiness_requests: Vec<ScreenshotReadinessRequest>,

    /// A map from `UserContentManagerId` to the `UserContents` for that manager.
    /// Multiple `WebView`s can share the same `UserContentManager` and any mutations
    /// to the `UserContents` need to be forwared to all the `ScriptThread`s that host
    /// the relevant `WebView`.
    pub(crate) user_contents_for_manager_id: FxHashMap<UserContentManagerId, UserContents>,

    /// Whether accessibility trees are being built and sent to the underlying platform.
    pub(crate) accessibility_active: bool,

    /// Pending force-GC callbacks waiting for all script threads to complete.
    /// The tuple is (remaining_count, callback).
    pending_force_gc: Option<(usize, GenericCallback<bool>)>,
}

/// State needed to construct a constellation.
pub struct InitialConstellationState {
    /// A channel through which messages can be sent to the embedder.
    pub embedder_proxy: EmbedderProxy,

    /// A channel through which messages can be sent to `Paint` in-process.
    pub paint_proxy: PaintProxy,

    /// A channel to the developer tools, if applicable.
    pub devtools_sender: Option<Sender<DevtoolsControlMsg>>,

    /// A channel to the bluetooth thread.
    #[cfg(feature = "bluetooth")]
    pub bluetooth_thread: GenericSender<BluetoothRequest>,

    /// A proxy to the `SystemFontService` which manages the list of system fonts.
    pub system_font_service: Arc<SystemFontServiceProxy>,

    /// A channel to the resource thread.
    pub public_resource_threads: ResourceThreads,


Review comment (suggestion):
This will make it easier to deal with this comment if we rename `ScriptThread` in the future (which is currently inaccurately named):

```suggestion
    /// Pending force-GC callbacks waiting for all `ScriptThread` to complete.
```

Code after:
    pub(crate) privileged_urls: Vec<ServoUrl>,

    /// The [`ImageCacheFactory`] to use for all `ScriptThread`s when we are running in
    /// single-process mode. In multi-process mode, each process will create its own
    /// [`ImageCacheFactoryImpl`].
    pub(crate) image_cache_factory: Arc<ImageCacheFactoryImpl>,

    /// Pending viewport changes for browsing contexts that are not
    /// yet known to the constellation.
    pending_viewport_changes: HashMap<BrowsingContextId, ViewportDetails>,

    /// Pending screenshot readiness requests. These are collected until the screenshot is
    /// ready to take place, at which point the Constellation informs the renderer that it
    /// can start the process of taking the screenshot.
    screenshot_readiness_requests: Vec<ScreenshotReadinessRequest>,

    /// A map from `UserContentManagerId` to the `UserContents` for that manager.
    /// Multiple `WebView`s can share the same `UserContentManager` and any mutations
    /// to the `UserContents` need to be forwared to all the `ScriptThread`s that host
    /// the relevant `WebView`.
    pub(crate) user_contents_for_manager_id: FxHashMap<UserContentManagerId, UserContents>,

    /// Whether accessibility trees are being built and sent to the underlying platform.
    pub(crate) accessibility_active: bool,
}

/// State needed to construct a constellation.
pub struct InitialConstellationState {
    /// A channel through which messages can be sent to the embedder.
    pub embedder_proxy: EmbedderProxy,

    /// A channel through which messages can be sent to `Paint` in-process.
    pub paint_proxy: PaintProxy,

    /// A channel to the developer tools, if applicable.
    pub devtools_sender: Option<Sender<DevtoolsControlMsg>>,

    /// A channel to the bluetooth thread.
    #[cfg(feature = "bluetooth")]
    pub bluetooth_thread: GenericSender<BluetoothRequest>,

    /// A proxy to the `SystemFontService` which manages the list of system fonts.
    pub system_font_service: Arc<SystemFontServiceProxy>,

    /// A channel to the resource thread.
    pub public_resource_threads: ResourceThreads,

    /// A channel to the resource thread.
    pub private_resource_threads: ResourceThreads,

    /// A channel to the storage thread.