Skip to content

Separate waking the event loop, from communicating with Compositor#17068

Merged
bors-servo merged 1 commit intoservo:masterfrom
gterzian:remove_compositorproxy
Jun 7, 2017
Merged

Separate waking the event loop, from communicating with Compositor#17068
bors-servo merged 1 commit intoservo:masterfrom
gterzian:remove_compositorproxy

Conversation

@gterzian
Copy link
Copy Markdown
Member

@gterzian gterzian commented May 28, 2017

@paulrouget first step of #15934, Glutin only for now, please take a look...

If this makes sense, I will also update the code for ports other than Glutin...

One question: one do I add the warn! macro to servolib? Also perhaps we would also want to add box, since I had to switch to using Box::new...


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label May 28, 2017
@gterzian gterzian changed the title Separate waking the event loop, from CompositorProxy [WIP] Separate waking the event loop, from CompositorProxy May 28, 2017
@gterzian gterzian changed the title [WIP] Separate waking the event loop, from CompositorProxy [WIP] Separate waking the event loop, from communicating with Compositor May 28, 2017
@gterzian gterzian force-pushed the remove_compositorproxy branch 6 times, most recently from 33227ca to ab7a4d0 Compare May 28, 2017 04:46
@jdm
Copy link
Copy Markdown
Member

jdm commented May 28, 2017

r? @paulrouget

@highfive highfive assigned paulrouget and unassigned jdm May 28, 2017
@gterzian gterzian force-pushed the remove_compositorproxy branch 2 times, most recently from 01170ae to 633ca33 Compare May 30, 2017 01:54
@gterzian
Copy link
Copy Markdown
Member Author

UPDATE: also added the implementation for the cef port...

Copy link
Copy Markdown
Contributor

@paulrouget paulrouget left a comment

Choose a reason for hiding this comment

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

Looks good to me. There are some nits to address. Also, I'm not 100% sure you need to use Box.

Once these addressed, I'd like @asajeffrey to take a look as well.

fn recv_compositor_msg(&mut self) -> Msg;
}

/// Used to wake up the event loop, provided by the Servo port.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/Servo port/embedder/

/// This is part of the windowing system because its implementation often involves OS-specific
/// magic to wake the up window's event loop.
fn create_compositor_channel(&self) -> (Box<CompositorProxy + Send>, Box<CompositorReceiver>);
/// Creates a thread-safe object to wake the up window's event loop.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo in comment.

}

fn create_compositor_channel(event_loop_riser: Box<compositor_thread::EventLoopRiser>)
-> (Box<CompositorProxy + Send>, Box<CompositorReceiver>) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Box<CompositorProxy + Send>, Box<CompositorReceiver>): do we still need boxed objects? Now that the implementation is not in the embedder anymore, we don't need a trait, we could use a regular struct (like BrowserCompositorProxy). It would then have a known size, and I don't think we would then need to box these?

I didn't look too closely, so maybe I'm wrong.

// Send a message and kick the OS event loop awake.
if let Err(err) = self.sender.send(msg) {
// NOTE: how to add the warn! macro?
//warn!("Failed to send response ({}).", err);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add #[macro_use] on top of extern crate log;

} as Box<CompositorProxy+Send>,
box receiver as Box<CompositorReceiver>)
fn create_event_loop_riser(&self) -> Box<EventLoopRiser> {
struct CefEventLoopRiser {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can just use struct CefEventLoopRiser;.

box receiver as Box<CompositorReceiver>)
box GlutinEventLoopRiser {
window_proxy: window_proxy,
} as Box<EventLoopRiser + Send>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the as … necessary?

fn clone(&self) -> Box<EventLoopRiser + Send> {
box GlutinEventLoopRiser {
window_proxy: self.window_proxy.clone(),
} as Box<EventLoopRiser + Send>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the as … necessary?

@jdm jdm 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. labels May 30, 2017
@gterzian gterzian force-pushed the remove_compositorproxy branch from 633ca33 to f630c34 Compare June 3, 2017 06:49
@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 Jun 3, 2017
@gterzian gterzian force-pushed the remove_compositorproxy branch 3 times, most recently from 03b225d to bab8f3a Compare June 4, 2017 01:55
@gterzian
Copy link
Copy Markdown
Member Author

gterzian commented Jun 4, 2017

@paulrouget Ok, I replaced the compositor related traits with structs, and addressed the other comments too...

I'm wondering if we need to add some sort of "clone" method to CompositorReceiver?

} as Box<CompositorProxy+Send>,
box receiver as Box<CompositorReceiver>)
fn create_event_loop_riser(&self) -> Box<EventLoopRiser> {
struct CefEventLoopRiser
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a ; at the end after CefEventLoopRiser.

}
fn clone(&self) -> Box<EventLoopRiser + Send> {
box CefEventLoopRiser {
} as Box<EventLoopRiser + Send>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you can just do:

fn clone() {
  box CefEventLoopRiser
}

@paulrouget
Copy link
Copy Markdown
Contributor

Thank you Greg. This looks good to me now (beside a nit).

I'd like to get a review from Alan.

@asajeffrey - this is the first step to clarify the Embedder <-> Constellation communication. Can you take a look too?

Copy link
Copy Markdown
Contributor

@asajeffrey asajeffrey left a comment

Choose a reason for hiding this comment

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

LGTM, I just have an annoying bikeshedding name change. EventLoopWakeup?

fn clone_compositor_proxy(&self) -> Box<CompositorProxy + 'static + Send>;

/// Used to wake up the event loop, provided by the servo port/embedder.
pub trait EventLoopRiser : 'static + Send {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: not sure about the name. A riser is a part of a staircase :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@paulrouget
Copy link
Copy Markdown
Contributor

paulrouget commented Jun 6, 2017

ajeffrey> "Waker" would probably be more colloquial English: "Awaker"
sounds like "I am more awake than you".

@gterzian gterzian force-pushed the remove_compositorproxy branch from 715e910 to 3a693c7 Compare June 6, 2017 07:46
@gterzian
Copy link
Copy Markdown
Member Author

gterzian commented Jun 6, 2017

Ok, EventLoopWaker it is...

@gterzian
Copy link
Copy Markdown
Member Author

gterzian commented Jun 7, 2017

It looks like approving in Github isn't enough, and somebody needs to do a r+ at the bot...

@asajeffrey
Copy link
Copy Markdown
Contributor

@bors-servo r+

@bors-servo
Copy link
Copy Markdown
Contributor

📋 Looks like this PR is still in progress, ignoring approval

@highfive highfive assigned asajeffrey and unassigned paulrouget Jun 7, 2017
@asajeffrey
Copy link
Copy Markdown
Contributor

Hmm, I wonder why bors reckons this is still a WIP. Is it the unchecked boxes in the PR description?

@paulrouget paulrouget changed the title [WIP] Separate waking the event loop, from communicating with Compositor Separate waking the event loop, from communicating with Compositor Jun 7, 2017
@paulrouget
Copy link
Copy Markdown
Contributor

Probably the title. I changed it. Do you need to re-approve?

@paulrouget
Copy link
Copy Markdown
Contributor

@asajeffrey
Copy link
Copy Markdown
Contributor

@bors-servo r+

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit 3a693c7 has been approved by asajeffrey

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jun 7, 2017
@gterzian
Copy link
Copy Markdown
Member Author

gterzian commented Jun 7, 2017

@paulrouget @asajeffrey thanks for the review.

@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit 3a693c7 with merge 7e273d6...

bors-servo pushed a commit that referenced this pull request Jun 7, 2017
Separate waking the event loop, from communicating with Compositor

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

@paulrouget first step of #15934, Glutin only for now, please take a look...

If this makes sense, I will also update the code for ports other than Glutin...

One question: one do I add the `warn!` macro to `servolib`? Also perhaps we would also want to add `box`, since I had to switch to using `Box::new`...

---
<!-- 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 #__ (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/17068)
<!-- Reviewable:end -->
@bors-servo
Copy link
Copy Markdown
Contributor

☀️ 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
Approved by: asajeffrey
Pushing 7e273d6 to master...

@bors-servo bors-servo merged commit 3a693c7 into servo:master Jun 7, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jun 7, 2017
@paulrouget
Copy link
Copy Markdown
Contributor

Thank you @gterzian

@gterzian gterzian deleted the remove_compositorproxy branch June 7, 2017 23:36
@asajeffrey
Copy link
Copy Markdown
Contributor

@gterzian thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants