Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate script and layout messages, issue #8843 #8958

Merged
merged 1 commit into from
Dec 26, 2015
Merged

Separate script and layout messages, issue #8843 #8958

merged 1 commit into from
Dec 26, 2015

Conversation

jkachmar
Copy link
Contributor

Separated layout-specific messages to the constellation out from the ScriptMsg enum into a LayoutMsg enum within script_traits/script_msg.rs, addresses #8843.

I initially tried to move LayoutMsg into layout_traits/lib.rs, but this introduced a cyclic dependency: layout_traits depends on script_traits for the LayoutTaskFactory implementation, and script_traits/script_task.rs now depends on LayoutMsg for new layout channels in InitialScriptState and ScriptTask.

Review on Reviewable

@highfive
Copy link

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @larsbergstrom (or someone else) soon.

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Dec 13, 2015
@highfive
Copy link

warning Warning warning

  • These commits modify layout code, but no reftests are modified. Please consider adding a reftest!

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #8979) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Dec 15, 2015
@Manishearth
Copy link
Member

r? @KiChjang

@@ -306,6 +307,13 @@ impl JSTraceable for ConstellationChan<ScriptMsg> {
}
}

impl JSTraceable for ConstellationChan<LayoutMsg> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just use no_jsmanaged_fields! on ConstellationChan<T>?

@Manishearth
Copy link
Member

@bors-servo delegate=KiChjang

Looks good to me (modulo nits) at a glance; Keith can do a more thorough review

@bors-servo
Copy link
Contributor

✌️ @KiChjang can now approve this pull request

@KiChjang
Copy link
Contributor

-S-awaiting-review -S-needs-rebase +S-needs-code-changes

Great job so far! I've left comments in places where care must be taken when dealing with passing messages to the constellation.

The most important idea here is to recognize that the script objects should only send ScriptMsgs to the constellation - it should not, in anyway, need a ConstellationChan<LayoutMsg>. That's reserved for layout objects.

Secondly, both script and layout objects should never need to know what kind of messages (i.e. ScriptMsgand LayoutMsg) that the underlying channel accepts - all they need to know is that they are, in fact, communicating with the constellation, hence the ScriptMsg as ConstellationMsg in script files and LayoutMsg as ConstellationMsg in layout files.


Reviewed 11 of 19 files at r1, 8 of 8 files at r2.
Review status: all files reviewed at latest revision, 11 unresolved discussions, some commit checks failed.


components/compositing/constellation.rs, line 102 [r2] (raw file):
nit: Should follow the comment style of previous receivers, i.e. "Receives messages from the layout task".


components/compositing/pipeline.rs, line 85 [r2] (raw file):
This is not actually true; it's a channel for the layout task to send messages to the constellation.


components/script/dom/document.rs, line 1163 [r2] (raw file):
This sounds very wrong to me. A document is a script object, and yet it is sending a LayoutMsg to the constellation. We should instead make two copies of the ChangeRunningAnimationsState message: one for LayoutMsgs, and the other for ScriptMsgs.


components/script/dom/window.rs, line 199 [r2] (raw file):
Again, wrong idea here. It's a channel to communicate with the constellation, but given the comment I left on document.rs, we really should remove this channel altogether.


components/script/layout_interface.rs, line 21 [r2] (raw file):
LayoutMsg as ConstellationMsg


components/script/lib.rs, line 51 [r2] (raw file):
Shouldn't be necessary anymore, since the original plan of moving LayoutMsg to layout_traits was scrapped.


components/script_traits/lib.rs, line 262 [r2] (raw file):
"from layout"; but we really should remove this, since this is from the script, and scripts should only ever send ScriptMsgs to the constellation.


Comments from the review on Reviewable.io

@KiChjang KiChjang added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Dec 16, 2015
@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #8612) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added S-needs-rebase There are merge conflict errors. S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Dec 17, 2015
@KiChjang
Copy link
Contributor

-S-awaiting-review -S-needs-rebase +S-needs-code-changes


Reviewed 13 of 16 files at r3.
Review status: all files reviewed at latest revision, 8 unresolved discussions.


components/layout/layout_task.rs, line 692 [r3] (raw file):
Since there's no other type of ConstellationChan, we can just leave it named as constellation_chan.


components/script/layout_interface.rs, line 259 [r3] (raw file):
I'm confused, why is there a ConstellationChan<ScriptMsg> here?


components/script/script_task.rs, line 1203 [r3] (raw file):
There's absolutely no need for the layout to have a ConstellationChan<ScriptMsg> at all. I don't find it necessary to add a new layout_to_constellation_chan field. You can just change the message type of constellation_chan to be LayoutMsg.


Comments from the review on Reviewable.io

@KiChjang KiChjang added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Dec 23, 2015
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Dec 26, 2015
@KiChjang
Copy link
Contributor

-S-awaiting-review

@bors-servo r+

Thanks for doing this!


Reviewed 5 of 11 files at r4.
Review status: all files reviewed at latest revision, 6 unresolved discussions.


Comments from the review on Reviewable.io

@bors-servo
Copy link
Contributor

📌 Commit 655268d has been approved by KiChjang

@KiChjang KiChjang removed the S-awaiting-review There is new code that needs to be reviewed. label Dec 26, 2015
@bors-servo
Copy link
Contributor

⌛ Testing commit 655268d with merge 941653d...

@highfive highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 26, 2015
bors-servo pushed a commit that referenced this pull request Dec 26, 2015
Separate script and layout messages, issue #8843

Separated layout-specific messages to the constellation out from the `ScriptMsg` enum into a `LayoutMsg` enum within `script_traits/script_msg.rs`, addresses [#8843](#8843).

I initially tried to move `LayoutMsg` into `layout_traits/lib.rs`, but this introduced a cyclic dependency: `layout_traits` depends on `script_traits` for the `LayoutTaskFactory` implementation, and `script_traits/script_task.rs` now depends on `LayoutMsg` for new layout channels in `InitialScriptState` and `ScriptTask`.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8958)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-ref-unit, mac-rel-css, mac-rel-wpt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants