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

[meta] Embedding notes 2020 #27579

Open
paulrouget opened this issue Aug 13, 2020 · 0 comments
Open

[meta] Embedding notes 2020 #27579

paulrouget opened this issue Aug 13, 2020 · 0 comments
Labels

Comments

@paulrouget
Copy link
Contributor

@paulrouget paulrouget commented Aug 13, 2020

Dumping some personal notes on, what I think, are the most-required structural changes for the servo embedding/composition story.

Looping:

  • do not run embedding code in the same thread as the compositor code #19679. Otherwise the embedder needs to implement the looping mechanism itself, which is rather annoying to build (I had to implement this loop for Android, UWP, winit, and Mac, it's getting old). Better do it once for all in Servo. Probably a lot easier now we rely on Surfman.

  • do not block on swapbuffer. Relying on the swapbuffer to block long enough to run at 60FPS makes orchestrating the requestAnimationFrame and layout changes very difficult (see all the 1000FPS / too many embedder calls bugs we had to deal with) . We need a dedicated thread that ticks on vblank that drives layout and rAF (like Gecko), and also we should remove the spurious animation frame check.

Support for more than one view:

  • Constellation should not assume there's one and only one compositor: #13993
  • Constellation should not even assume a compositor is up and running
  • It should be possible to create a compositor instance after creating the constellation #21808

This will be necessary for a proper tab support (kind of supported already by ugly) and multi-window support.

More on this there: #23179

Embedder:

  • The C-API we have in Servo seems like the best approach. The design is ugly at the moment, but it turns out to be the most flexible solution, as opposed to offering a Rust API (see the pain here: https://github.com/paulrouget/servo-embedding-example). We managed to get a UIKit view, a UWP Control, a GTK Widget and a Android view.
  • We should kill the winit port. The C library should be used in our main port (which is used for testing).
  • We need to delegate any disk IO to the embedder, and fully sandbox Servo processes.
  • memory issue: #26851 & #27115. We need a mechanism to free structure allocated in the embedder code, from Servo. We need a mechanism to free structure allocated in the Servo, from the embedder code.

Cosmetic changes:

  • there's no point of using events to send messages to servo. We can use regular function. This has been a pain, and we have been wrapping these events into functions anyway
  • The C-API is naive, flat, and honestly ugly (my fault), but it should be a no-brainer to re-organize that better. Also, #22967.
@CYBAI CYBAI added the A-embedding label Aug 15, 2020
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
2 participants
You can’t perform that action at this time.