Remove compositor forwarding code and use dedicated mechanism#17269
Conversation
|
Heads up! This PR modifies the following files:
|
e9c224a to
88fa2fc
Compare
|
Can you add a change to ports/ to show how this endup being used? Maybe you could rewrite the title update mechanism (the title of the current page is displayed in the glutin window). |
|
Two examples where the compositor should not been involved:
|
|
☔ The latest upstream changes (presumably #16477) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@paulrouget I've just added a commit to support changing the page title, tested it locally and "it works". It doesn't require any changes in ports, however it does require reaching for the root pipeline inside the compositor. |
88657cf to
b0ffab7
Compare
|
@paulrouget Ok now also added support for:
|
| pub enum EmbedderMsg { | ||
| /// A status message to be displayed by the browser chrome. | ||
| Status(Option<String>), | ||
| /// Alerts the compositor that the current page has changed its title. |
| @@ -29,6 +29,42 @@ pub trait EventLoopWaker : 'static + Send { | |||
| fn wake(&self); | |||
| } | |||
|
|
|||
| } | ||
| } | ||
| } | ||
|
|
| /// A channel for the constellation to receive messages from the compositor thread. | ||
| compositor_receiver: Receiver<FromCompositorMsg>, | ||
|
|
||
| embedder_proxy: EmbedderProxy, |
|
|
||
| /// State needed to construct a constellation. | ||
| pub struct InitialConstellationState { | ||
| pub embedder_proxy: EmbedderProxy, |
components/servo/lib.rs
Outdated
| (EmbedderProxy { | ||
| sender: sender, | ||
| event_loop_waker: event_loop_waker, | ||
| }, |
components/servo/lib.rs
Outdated
| (_, _) => {}, | ||
| } | ||
| } | ||
| for event in events.clone() { |
There was a problem hiding this comment.
Since the variants of WindowEvent handled by the embedder and the compositor are disjoint, it would be better to have two separate types. Maybe the window should store events for the compositor and events for the embedder?
There was a problem hiding this comment.
Good point. I would almost be tempted to think that all window events should be handled by Browser, which could call the appropriate methods of compositor, or handle those differently(such as in the cases where the compositor isn't involved). Maybe this could also help support multiple compositors down the line? @paulrouget
So in other words, all window events could be handled here, and Browser could either call a method of 'window', or 'compositor', or both, in response to each event.
components/servo/lib.rs
Outdated
| fn handle_window_event(&mut self, event: WindowEvent) { | ||
| match event { | ||
| WindowEvent::Reload => { | ||
| let top_level_browsing_context_id = match self.compositor.root_pipeline { |
There was a problem hiding this comment.
Is the plan to eventually allow the embedder to handle the current top_level_browsing_context_id?
cc @paulrouget
There was a problem hiding this comment.
Eventually, the embedder will have a list of top_level_browsing_context_id (tabs).
There was a problem hiding this comment.
So asking the compositor for the root pipeline to get the context id will be be a temporary thing.
|
☔ The latest upstream changes (presumably #17184) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@cbrewster thanks for the review so far, I'm on standby for a bit more "big picture" guidance from @paulrouget... |
|
OK so I've done one more thing to just follow along the current line, and learned some stuff along the way:
My conclusion so far on this experiment:
|
01c4eaf to
186139c
Compare
|
@paulrouget Ok just to continue the current experiment, I made an attempt to move all messages from constellation that don't relate to the compositor to the dedicated "embedder" channel, and I've also moved all window event handling from compositor to browser. I think the first part is the stated goal of this issue, and I'm wondering if we shouldn't include moving all window event handling as I did as well. Worth noting is that the way the compositor was previously handling it's "own" messages, as well as window events, was intertwined with the When I run servo, I keep getting a Also when I tried to run some tests, it seemed very slow, and I'm not sure if it's just my machine or if I introduce something that slows down the event loop or something else... (note: the PR still contains debug messages). |
|
@gterzian your work and my work may conflict. It's work in progress, but you might want to take a look: master...paulrouget:attach-pipeline-wip |
|
@paulrouget There will defenitely be a huge "conflict" in terms of git 😄 , however the direction you're moving to is very compatibly with what I am trying to do here, since it seems to be moving logic out of the compositor. If "browser/servo" handles |
|
☔ The latest upstream changes (presumably #17398) made this pull request unmergeable. Please resolve the merge conflicts. |
d4e1022 to
e79db2e
Compare
|
⌛ Testing commit 6bca340 with merge 1657ad4815034e5c27cf130f7ef77adfb1030ba3... |
|
💔 Test failed - mac-rel-wpt2 |
|
⌛ Testing commit 6bca340 with merge 9307f29805768714a3dee54a32b0e9b672ccfd92... |
|
💔 Test failed - mac-rel-wpt2 |
|
Same error multiple times in a row. What does it mean? |
…_use_dedicated_mechanism, r=asajeffrey Remove compositor forwarding code and use dedicated mechanism <!-- Please describe your changes on the following line: --> @paulrouget Here is a first sketch of the proposed "design", handling a first message as a proof of concept, if you could please already take a look before I move all the messages(or method calls) across... thanks --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #15934 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17269) <!-- Reviewable:end -->
|
💔 Test failed - mac-rel-wpt1 |
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
|
Thank you all for your help. |
@paulrouget Here is a first sketch of the proposed "design", handling a first message as a proof of concept, if you could please already take a look before I move all the messages(or method calls) across... thanks
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is