mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 11:09:05 +03:00
Browser: Add a debug menu action for triggering a JS garbage collection
Triggering a GC this way will print a report afterwards so you can see how much memory is currently used by the JS heap. :^)
This commit is contained in:
parent
bbd3192535
commit
154a184c1b
Notes:
sideshowbarker
2024-07-19 03:32:15 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/154a184c1bc
@ -361,6 +361,17 @@ Tab::Tab(Type type)
|
||||
line_box_borders_action->set_checked(false);
|
||||
debug_menu.add_action(line_box_borders_action);
|
||||
|
||||
debug_menu.add_separator();
|
||||
debug_menu.add_action(GUI::Action::create("Collect garbage", { Mod_Ctrl | Mod_Shift, Key_G }, [this](auto&) {
|
||||
if (m_type == Type::InProcessWebView) {
|
||||
if (auto* document = m_page_view->document()) {
|
||||
document->interpreter().heap().collect_garbage(JS::Heap::CollectionType::CollectGarbage, true);
|
||||
}
|
||||
} else {
|
||||
TODO();
|
||||
}
|
||||
}));
|
||||
|
||||
auto& bookmarks_menu = m_menubar->add_menu("Bookmarks");
|
||||
bookmarks_menu.add_action(WindowActions::the().show_bookmarks_bar_action());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user