Rename IOCompositor to Paint (#41176)

For a long time, the "Compositor" hasn't done any compositing. This is
handled by WebRender. In addition the "Compositor" does many other
tasks. This change renames `IOCompositor` to `Paint`.

`Paint` is Servo's paint subsystem and contains multiple `Painter`s.
This change does not rename the crate; that will be done in a
followup change.

Testing: This just renames types and updates comments, so no new tests
are necessary.

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2025-12-10 16:09:49 +01:00
committed by GitHub
parent 0e1ab937b3
commit 824f551f03
61 changed files with 592 additions and 629 deletions

View File

@@ -40,7 +40,7 @@ use base::id::{
};
use canvas_traits::webgl::WebGLPipeline;
use chrono::{DateTime, Local};
use compositing_traits::{CrossProcessCompositorApi, PipelineExitSource};
use compositing_traits::{CrossProcessPaintApi, PipelineExitSource};
use constellation_traits::{
JsEvalResult, LoadData, LoadOrigin, NavigationHistoryBehavior, ScreenshotReadinessResponse,
ScriptToConstellationChan, ScriptToConstellationMessage, StructuredSerializedData,
@@ -306,9 +306,9 @@ pub struct ScriptThread {
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
custom_element_reaction_stack: Rc<CustomElementReactionStack>,
/// Cross-process access to the compositor's API.
/// Cross-process access to `Paint`'s API.
#[no_trace]
compositor_api: CrossProcessCompositorApi,
paint_api: CrossProcessPaintApi,
/// Periodically print out on which events script threads spend their processing time.
profile_script_events: bool,
@@ -963,7 +963,7 @@ impl ScriptThread {
worklet_thread_pool: Default::default(),
docs_with_no_blocking_loads: Default::default(),
custom_element_reaction_stack: Rc::new(CustomElementReactionStack::new()),
compositor_api: state.cross_process_compositor_api,
paint_api: state.cross_process_paint_api,
profile_script_events: opts.debug.profile_script_events,
print_pwm: opts.print_pwm,
unminify_js: opts.unminify_js,
@@ -1018,15 +1018,15 @@ impl ScriptThread {
debug!("Stopped script thread.");
}
/// Process compositor events as part of a "update the rendering task".
/// Process input events as part of a "update the rendering task".
fn process_pending_input_events(&self, pipeline_id: PipelineId, can_gc: CanGc) {
let Some(document) = self.documents.borrow().find_document(pipeline_id) else {
warn!("Processing pending compositor events for closed pipeline {pipeline_id}.");
warn!("Processing pending input events for closed pipeline {pipeline_id}.");
return;
};
// Do not handle events if the BC has been, or is being, discarded
if document.window().Closed() {
warn!("Compositor event sent to a pipeline with a closed window {pipeline_id}.");
warn!("Input event sent to a pipeline with a closed window {pipeline_id}.");
return;
}
@@ -1122,7 +1122,7 @@ impl ScriptThread {
// TODO(#31581): The steps in the "Revealing the document" section need to be implemented
// `process_pending_input_events` handles the focusing steps as well as other events
// from the compositor.
// from `Paint`.
// TODO: Should this be broken and to match the specification more closely? For instance see
// https://html.spec.whatwg.org/multipage/#flush-autofocus-candidates.
@@ -1205,7 +1205,7 @@ impl ScriptThread {
let should_generate_frame = !painters_generating_frames.is_empty();
if should_generate_frame {
self.compositor_api
self.paint_api
.generate_frame(painters_generating_frames.into_iter().collect());
}
@@ -2960,7 +2960,7 @@ impl ScriptThread {
))
.ok();
self.compositor_api
self.paint_api
.pipeline_exited(webview_id, pipeline_id, PipelineExitSource::Script);
debug!("{pipeline_id}: Finished pipeline exit");
@@ -3128,14 +3128,14 @@ impl ScriptThread {
let font_context = Arc::new(FontContext::new(
self.system_font_service.clone(),
self.compositor_api.clone(),
self.paint_api.clone(),
self.resource_threads.clone(),
));
let image_cache = self.image_cache_factory.create(
incomplete.webview_id,
incomplete.pipeline_id,
&self.compositor_api,
&self.paint_api,
);
let layout_config = LayoutConfig {
@@ -3147,7 +3147,7 @@ impl ScriptThread {
image_cache: image_cache.clone(),
font_context: font_context.clone(),
time_profiler_chan: self.senders.time_profiler_sender.clone(),
compositor_api: self.compositor_api.clone(),
paint_api: self.paint_api.clone(),
viewport_details: incomplete.viewport_details,
theme: incomplete.theme,
};
@@ -3185,7 +3185,7 @@ impl ScriptThread {
self.webgl_chan.as_ref().map(|chan| chan.channel()),
#[cfg(feature = "webxr")]
self.webxr_registry.clone(),
self.compositor_api.clone(),
self.paint_api.clone(),
self.unminify_js,
self.unminify_css,
self.local_script_source.clone(),
@@ -3400,8 +3400,7 @@ impl ScriptThread {
}
}
/// Queue compositor events for later dispatching as part of a
/// `update_the_rendering` task.
/// Queue input events for later dispatching as part of a `update_the_rendering` task.
fn handle_input_event(
&self,
webview_id: WebViewId,
@@ -3409,7 +3408,7 @@ impl ScriptThread {
event: ConstellationInputEvent,
) {
let Some(document) = self.documents.borrow().find_document(pipeline_id) else {
warn!("Compositor event sent to closed pipeline {pipeline_id}.");
warn!("Input event sent to closed pipeline {pipeline_id}.");
let _ = self
.senders
.pipeline_to_embedder_sender