Separate waking the event loop, from communicating with Compositor#17068
Separate waking the event loop, from communicating with Compositor#17068bors-servo merged 1 commit intoservo:masterfrom
Conversation
33227ca to
ab7a4d0
Compare
|
r? @paulrouget |
01170ae to
633ca33
Compare
|
UPDATE: also added the implementation for the cef port... |
paulrouget
left a comment
There was a problem hiding this comment.
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. |
components/compositing/windowing.rs
Outdated
| /// 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. |
components/servo/lib.rs
Outdated
| } | ||
|
|
||
| fn create_compositor_channel(event_loop_riser: Box<compositor_thread::EventLoopRiser>) | ||
| -> (Box<CompositorProxy + Send>, Box<CompositorReceiver>) { |
There was a problem hiding this comment.
(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.
components/servo/lib.rs
Outdated
| // 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); |
There was a problem hiding this comment.
Add #[macro_use] on top of extern crate log;
ports/cef/window.rs
Outdated
| } as Box<CompositorProxy+Send>, | ||
| box receiver as Box<CompositorReceiver>) | ||
| fn create_event_loop_riser(&self) -> Box<EventLoopRiser> { | ||
| struct CefEventLoopRiser {} |
There was a problem hiding this comment.
You can just use struct CefEventLoopRiser;.
ports/glutin/window.rs
Outdated
| box receiver as Box<CompositorReceiver>) | ||
| box GlutinEventLoopRiser { | ||
| window_proxy: window_proxy, | ||
| } as Box<EventLoopRiser + Send> |
ports/glutin/window.rs
Outdated
| fn clone(&self) -> Box<EventLoopRiser + Send> { | ||
| box GlutinEventLoopRiser { | ||
| window_proxy: self.window_proxy.clone(), | ||
| } as Box<EventLoopRiser + Send> |
633ca33 to
f630c34
Compare
03b225d to
bab8f3a
Compare
|
@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 |
ports/cef/window.rs
Outdated
| } as Box<CompositorProxy+Send>, | ||
| box receiver as Box<CompositorReceiver>) | ||
| fn create_event_loop_riser(&self) -> Box<EventLoopRiser> { | ||
| struct CefEventLoopRiser |
There was a problem hiding this comment.
Add a ; at the end after CefEventLoopRiser.
ports/cef/window.rs
Outdated
| } | ||
| fn clone(&self) -> Box<EventLoopRiser + Send> { | ||
| box CefEventLoopRiser { | ||
| } as Box<EventLoopRiser + Send> |
There was a problem hiding this comment.
I think you can just do:
fn clone() {
box CefEventLoopRiser
}|
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? |
asajeffrey
left a comment
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Nit: not sure about the name. A riser is a part of a staircase :)
There was a problem hiding this comment.
How about EventLoopAwaker, so that we have a noun? https://en.wiktionary.org/wiki/awaker
|
715e910 to
3a693c7
Compare
|
Ok, |
|
It looks like approving in Github isn't enough, and somebody needs to do a r+ at the bot... |
|
@bors-servo r+ |
|
📋 Looks like this PR is still in progress, ignoring approval |
|
Hmm, I wonder why bors reckons this is still a WIP. Is it the unchecked boxes in the PR description? |
|
Probably the title. I changed it. Do you need to re-approve? |
|
@bors-servo r+ |
|
📌 Commit 3a693c7 has been approved by |
|
@paulrouget @asajeffrey thanks for the review. |
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 -->
|
☀️ 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 @gterzian |
|
@gterzian thanks! |
@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 toservolib? Also perhaps we would also want to addbox, since I had to switch to usingBox::new..../mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is