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

Conversation

@jkachmar
Copy link
Contributor

jkachmar commented Dec 13, 2015

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

highfive commented Dec 13, 2015

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
Copy link

highfive commented Dec 13, 2015

warning Warning warning

  • These commits modify layout code, but no reftests are modified. Please consider adding a reftest!
@bors-servo
Copy link
Contributor

bors-servo commented Dec 15, 2015

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

@Manishearth
Copy link
Member

Manishearth commented Dec 16, 2015

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

impl JSTraceable for ConstellationChan<LayoutMsg> {

This comment has been minimized.

Copy link
@Manishearth

Manishearth Dec 16, 2015

Member

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

@@ -22,6 +22,9 @@ path = "../net_traits"
[dependencies.profile_traits]
path = "../profile_traits"

[dependencies.style_traits]
path = "../style_traits"

This comment has been minimized.

Copy link
@Manishearth

Manishearth Dec 16, 2015

Member

Why is this necessary?

@@ -27,6 +27,9 @@ path = "../net_traits"
[dependencies.profile_traits]
path = "../profile_traits"

[dependencies.layout_traits]
path = "../layout_traits"

This comment has been minimized.

Copy link
@Manishearth

Manishearth Dec 16, 2015

Member

Why is this necessary? LayoutMsg is defined in script_traits

@Manishearth
Copy link
Member

Manishearth commented Dec 16, 2015

@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

bors-servo commented Dec 16, 2015

✌️ @KiChjang can now approve this pull request

@KiChjang
Copy link
Member

KiChjang commented Dec 16, 2015

-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

@bors-servo
Copy link
Contributor

bors-servo commented Dec 17, 2015

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

@KiChjang
Copy link
Member

KiChjang commented Dec 23, 2015

-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
Copy link
Member

KiChjang commented Dec 26, 2015

-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

bors-servo commented Dec 26, 2015

📌 Commit 655268d has been approved by KiChjang

@bors-servo
Copy link
Contributor

bors-servo commented Dec 26, 2015

Testing commit 655268d with merge 941653d...

bors-servo added 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

bors-servo commented Dec 26, 2015

@bors-servo bors-servo merged commit 655268d into servo:master Dec 26, 2015
2 of 3 checks passed
2 of 3 checks passed
code-review/reviewable Review in progress: all files reviewed, 6 unresolved discussions
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.