Truly independent web browser
LibWebView: Move the tab performance monitor toggle to the Debug menu
Andreas Kling93ec8d0f1eb8
diff --git a/Documentation/TabPerformanceMonitor.md b/Documentation/TabPerformanceMonitor.mdindex 1a6646222af..43aeb62d035 100644--- a/Documentation/TabPerformanceMonitor.md+++ b/Documentation/TabPerformanceMonitor.md@@ -3,7 +3,8 @@# Tab performance monitor-Enable **Show tab performance monitor** in **Settings → Advanced**, or set+Enable **Show Tab Performance Monitor** in the **Debug** menu, which **Show+Debug menu** in **Settings → Advanced** turns on, or set`debug.ui.show_tab_performance_monitor` to `true`. It defaults to `false`.The UI's toolbars display the current tab's statistics inline.Each tab retains its own CPU history while monitoring is enabled.diff --git a/Libraries/LibWebView/Application.cpp b/Libraries/LibWebView/Application.cppindex 3e5b19db0e3..7844f646a17 100644--- a/Libraries/LibWebView/Application.cpp+++ b/Libraries/LibWebView/Application.cpp@@ -159,6 +159,10 @@ struct ApplicationSettingsObserver final : public SettingsObserver {auto enabled = Application::settings().config_variable_as_bool(ConfigVariableID::ShowAdvancedDebugMenu);Application::the().debug_menu().set_visible(enabled);}+ if (variable == ConfigVariableID::ShowTabPerformanceMonitor) {+ auto enabled = Application::settings().config_variable_as_bool(ConfigVariableID::ShowTabPerformanceMonitor);+ Application::the().show_tab_performance_monitor_action().set_checked(enabled);+ }}virtual void background_networking_settings_changed() override@@ -2939,6 +2943,12 @@ void Application::initialize_actions()m_show_caret_hit_test_debug_overlay_action = Action::create_checkable("Show Caret Hit Test Debug Overlay"sv, ActionID::ShowCaretHitTestDebugOverlay, check(m_show_caret_hit_test_debug_overlay_action, "set-caret-hit-test-debug-overlay"sv));m_debug_menu->add_action(*m_show_caret_hit_test_debug_overlay_action);++ m_show_tab_performance_monitor_action = Action::create_checkable("Show Tab Performance Monitor"sv, ActionID::ShowTabPerformanceMonitor, [this]() {+ m_settings->set_config_variable(ConfigVariableID::ShowTabPerformanceMonitor, m_show_tab_performance_monitor_action->checked());+ });+ m_show_tab_performance_monitor_action->set_checked(m_settings->config_variable_as_bool(ConfigVariableID::ShowTabPerformanceMonitor));+ m_debug_menu->add_action(*m_show_tab_performance_monitor_action);m_debug_menu->add_separator();m_debug_menu->add_action(Action::create("Report Leaked Documents"sv, ActionID::ReportLeakedDocuments, debug_request("report-leaked-documents"sv)));diff --git a/Libraries/LibWebView/Application.h b/Libraries/LibWebView/Application.hindex 63783e06936..d7c72914ca1 100644--- a/Libraries/LibWebView/Application.h+++ b/Libraries/LibWebView/Application.h@@ -425,6 +425,7 @@ public:void update_report_website_issue_action();Menu& debug_menu() { return *m_debug_menu; }+ Action& show_tab_performance_monitor_action() { return *m_show_tab_performance_monitor_action; }FileDownloader& file_downloader() { return m_file_downloader; }@@ -770,6 +771,7 @@ private:RefPtr<Menu> m_debug_menu;RefPtr<Action> m_show_line_box_borders_action;RefPtr<Action> m_show_caret_hit_test_debug_overlay_action;+ RefPtr<Action> m_show_tab_performance_monitor_action;RefPtr<Action> m_enable_scripting_action;RefPtr<Action> m_block_pop_ups_action;StringView m_user_agent_string;diff --git a/Libraries/LibWebView/Menu.h b/Libraries/LibWebView/Menu.hindex daaa7b2b737..1aa448bde9d 100644--- a/Libraries/LibWebView/Menu.h+++ b/Libraries/LibWebView/Menu.h@@ -134,6 +134,7 @@ enum class ActionID {ReportLeakedDocuments,ShowLineBoxBorders,ShowCaretHitTestDebugOverlay,+ ShowTabPerformanceMonitor,CollectGarbage,CrashCurrentPage,CrashCompositorProcess,diff --git a/Libraries/LibWebView/WebUI/SettingsUI.cpp b/Libraries/LibWebView/WebUI/SettingsUI.cppindex 68b3c460345..efb9406826c 100644--- a/Libraries/LibWebView/WebUI/SettingsUI.cpp+++ b/Libraries/LibWebView/WebUI/SettingsUI.cpp@@ -46,6 +46,9 @@ static StringView config_variable_type_to_string(JsonValue::Type type)static bool should_show_config_variable(ConfigVariableID id){+ // NB: The Debug menu has the toggle for this one.+ if (id == ConfigVariableID::ShowTabPerformanceMonitor)+ return false;if (id == ConfigVariableID::ShowFeedbackButton)return !BROWSER_IS_FINAL_RELEASE;if (id == ConfigVariableID::UseClientSideWindowDecorations)