1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37:34 +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

@ -1075,7 +1075,7 @@ void Window::set_menubar(RefPtr<Menubar> menubar)
m_menubar = move(menubar);
if (m_window_id && m_menubar) {
m_menubar->notify_added_to_window({});
WindowServerConnection::the().set_window_menubar(m_window_id, m_menubar->menubar_id());
WindowServerConnection::the().async_set_window_menubar(m_window_id, m_menubar->menubar_id());
}
}