script_layout: Remove script to layout messages (#32081)

Instead of communicating with layout via messages, script can simply
call methods on the layout trait. This simplifies the way that script
communicates with layout and opens the path to sharing more data
structures between the two systems. This is part of a continuing 
series of cleanups after removing the layout thread.

<!-- Please describe your changes on the following line: -->


---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by
`[X]` when the step is complete, and replace `___` with appropriate
data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because they should not change
behavior.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox
is checked, so that we can help you if you get stuck somewhere along the
way.-->

<!-- Pull requests that do not address these steps are welcome, but they
will require additional verification as part of the review process. -->
This commit is contained in:
Martin Robinson 2024-04-22 17:28:14 +02:00 committed by GitHub
parent 97376e6d96
commit 7d63c7607f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 324 additions and 416 deletions

View file

@ -71,8 +71,9 @@ use parking_lot::Mutex;
use percent_encoding::percent_decode;
use profile_traits::mem::{self as profile_mem, OpaqueSender, ReportsChan};
use profile_traits::time::{self as profile_time, profile, ProfilerCategory};
use script_layout_interface::message::{Msg, ReflowGoal};
use script_layout_interface::{Layout, LayoutConfig, LayoutFactory, ScriptThreadFactory};
use script_layout_interface::{
Layout, LayoutConfig, LayoutFactory, ReflowGoal, ScriptThreadFactory,
};
use script_traits::webdriver_msg::WebDriverScriptCommand;
use script_traits::CompositorEvent::{
CompositionEvent, GamepadEvent, IMEDismissedEvent, KeyboardEvent, MouseButtonEvent,
@ -1210,7 +1211,7 @@ impl ScriptThread {
};
let _ = window
.with_layout(|layout| layout.process(Msg::RegisterPaint(name, properties, painter)));
.with_layout(|layout| layout.register_paint_worklet_modules(name, properties, painter));
}
pub fn push_new_element_queue() {
@ -2907,9 +2908,7 @@ impl ScriptThread {
}
debug!("{id}: Shutting down layout");
let _ = document.window().with_layout(|layout| {
layout.process(Msg::ExitNow);
});
let _ = document.window().with_layout(|layout| layout.exit_now());
debug!("{id}: Sending PipelineExited message to constellation");
self.script_sender