1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:28:13 +00:00

WindowServer+LibGUI: Make much of menu construction asynchronous

Creating a menu/menubar needs to be synchronous because we need the
ID from the response, but adding stuff *to* menus (and adding menus
to menubars, and menubars to windows) can all be asynchronous.

This dramatically reduces the amount of IPC ping-pong played by
each GUI application during startup.

I measured how long it takes TextEditor to enter the main event loop
and it's over 10% faster here. (Down from ~86ms to ~74ms)
This commit is contained in:
Andreas Kling 2021-05-03 21:27:22 +02:00
parent 8a6db55e79
commit a8a899adbf
5 changed files with 11 additions and 11 deletions

View file

@ -49,7 +49,7 @@ void Menubar::notify_added_to_window(Badge<Window>)
for (auto& menu : m_menus) {
int menu_id = menu.realize_menu();
VERIFY(menu_id != -1);
WindowServerConnection::the().add_menu_to_menubar(m_menubar_id, menu_id);
WindowServerConnection::the().async_add_menu_to_menubar(m_menubar_id, menu_id);
}
}