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

ScriptToCompositorMsg messages should probably be sent to the constellation instead #11345

Closed
Ms2ger opened this issue May 23, 2016 · 3 comments
Closed

Comments

@Ms2ger
Copy link
Contributor

@Ms2ger Ms2ger commented May 23, 2016

CC @pcwalton @glennw @larsbergstrom

This is assuming the compositor should be a global structure rather than per-top-level-browsing-context; correct me if that's wrong.

None of these seem like they should be global:

pub enum ScriptToCompositorMsg {
    /// Scroll a page in a window
    ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>, bool),
    /// Set title of current page
    /// https://html.spec.whatwg.org/multipage/#document.title
    SetTitle(PipelineId, Option<String>),
    /// Send a key event
    SendKeyEvent(Key, KeyState, KeyModifiers),
    /// Get Window Informations size and position
    GetClientWindow(IpcSender<(Size2D<u32>, Point2D<i32>)>),
    /// Move the window to a point
    MoveTo(Point2D<i32>),
    /// Resize the window to size
    ResizeTo(Size2D<u32>),
    /// Script has handled a touch event, and either prevented or allowed default actions.
    TouchEventProcessed(EventResult),
    /// Get Scroll Offset
    GetScrollOffset(PipelineId, LayerId, IpcSender<Point2D<f32>>),
    /// Requests that the compositor shut down.
    Exit,
    /// Allow the compositor to free script-specific resources.
    Exited,
}
@pcwalton
Copy link
Contributor

@pcwalton pcwalton commented May 24, 2016

So ultimately I think that there should be multiple compositors, when we have multiple windows. But that's orthogonal to this proposal.

I think you're absolutely right; these should be constellation messages.

@jdm
Copy link
Member

@jdm jdm commented May 24, 2016

As in they should be sent to the constellation, then sent to the compositor? Why?

@pcwalton
Copy link
Contributor

@pcwalton pcwalton commented May 24, 2016

In case the page is in an iframe or in a background tab, etc, I would think.

Ms2ger added a commit to Ms2ger/servo that referenced this issue May 25, 2016
We needed a separate thread in the chrome process because communication to the
compositor is done through a trait object, and cross-process virtual calls are
forbidden.

Also, the fact that these messages are ultimately handled by the compositor is
an implementation detail; conceptually, the relevant constellation is supposed
to handle these messages.

So instead, the script thread will now send the messages to the constellation,
which will ask the compositor to handle them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.