summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Menubar.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-05-03 21:27:22 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-03 21:56:13 +0200
commita8a899adbf9a3057ea8e498db7d4504b40f5a40e (patch)
tree38e540aeb7455fb73193b658f05f78b1268a12a8 /Userland/Libraries/LibGUI/Menubar.cpp
parent8a6db55e79ee484bc071fcb52ca30da069231f77 (diff)
downloadserenity-a8a899adbf9a3057ea8e498db7d4504b40f5a40e.zip
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)
Diffstat (limited to 'Userland/Libraries/LibGUI/Menubar.cpp')
-rw-r--r--Userland/Libraries/LibGUI/Menubar.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/Menubar.cpp b/Userland/Libraries/LibGUI/Menubar.cpp
index 4caa05ae96..8fda7c477f 100644
--- a/Userland/Libraries/LibGUI/Menubar.cpp
+++ b/Userland/Libraries/LibGUI/Menubar.cpp
@@ -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);
}
}