From a563ffd5ac19f61f504834d86ba7187c49ba2f3b Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Sat, 11 Apr 2020 20:56:22 -0400 Subject: [PATCH] Cache some frequently hit settings in LLCachedControl --- indra/newview/llpanelpermissions.cpp | 3 ++- indra/newview/llsidepaneltaskinfo.cpp | 3 ++- indra/newview/lltoolpie.cpp | 3 ++- indra/newview/llviewerkeyboard.cpp | 3 ++- indra/newview/llviewerwindow.cpp | 6 ++++-- indra/newview/llvoicevivox.cpp | 4 +++- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 1680326d9e5..6c7342f209a 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -293,7 +293,8 @@ void LLPanelPermissions::refresh() if(BtnDeedToGroup) { std::string deedText; - if (gWarningSettings.getBOOL("DeedObject")) + static const LLCachedControl<bool> deed_object(gWarningSettings, "DeedObject"); + if (deed_object) { deedText = getString("text deed continued"); } diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index a6000e6844f..33c291243ec 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -261,7 +261,8 @@ void LLSidepanelTaskInfo::refresh() if (btn_deed_to_group) { std::string deedText; - if (gWarningSettings.getBOOL("DeedObject")) + static const LLCachedControl<bool> deed_object(gWarningSettings, "DeedObject"); + if (deed_object) { deedText = getString("text deed continued"); } diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 218e35dd3fe..61a88085756 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -1167,6 +1167,7 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l ( (RlvActions::canInteract(hover_object, mHoverPick.mObjectOffset)) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, hover_object->getID())) ) ) { // [/RLVa:KB] + static const LLCachedControl<bool> av_inspector_tooltip_delay(gSavedSettings, "AvatarInspectorTooltipDelay"); LLInspector::Params p; p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>()); p.message(final_name); @@ -1174,7 +1175,7 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l p.click_callback(boost::bind(showAvatarInspector, hover_object->getID())); p.visible_time_near(6.f); p.visible_time_far(3.f); - p.delay_time(gSavedSettings.getF32("AvatarInspectorTooltipDelay")); + p.delay_time(av_inspector_tooltip_delay); p.wrap(false); LLToolTipMgr::instance().show(p); diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 5a442eb4bc9..952c80ad40f 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -112,13 +112,14 @@ static void agent_check_temporary_run(LLAgent::EDoubleTapRunMode mode) static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode mode) { + static LLCachedControl<bool> allow_tap_hold_run(gSavedSettings, "AllowTapTapHoldRun", true); if (KEYSTATE_UP == s) { // Note: in case shift is already released, slide left/right run // will be released in agent_turn_left()/agent_turn_right() agent_check_temporary_run(mode); } - else if (gSavedSettings.getBOOL("AllowTapTapHoldRun") && + else if (allow_tap_hold_run && KEYSTATE_DOWN == s && !gAgent.getRunning()) { diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index ccb6e4d5f2a..6eab4020cb2 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2908,7 +2908,8 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // If "Pressing letter keys starts local chat" option is selected, we are not in mouselook, // no view has keyboard focus, this is a printable character key (and no modifier key is // pressed except shift), then give focus to nearby chat (STORM-560) - if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && + static const LLCachedControl<S32> letter_keys_Focus_chat_bar(gSavedSettings, "LetterKeysFocusChatBar"); + if (letter_keys_Focus_chat_bar && !gAgentCamera.cameraMouselook() && !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) ) { // Initialize nearby chat if it's missing @@ -3109,7 +3110,8 @@ void LLViewerWindow::clearPopups() void LLViewerWindow::moveCursorToCenter() { - if (! gSavedSettings.getBOOL("DisableMouseWarp")) + static LLCachedControl<bool> disable_mouse_warp(gSavedSettings, "DisableMouseWarp"); + if (!disable_mouse_warp) { S32 x = getWorldViewWidthScaled() / 2; S32 y = getWorldViewHeightScaled() / 2; diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 3b9fce9d122..edb2e922c82 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -5171,7 +5171,9 @@ void LLVivoxVoiceClient::setVoiceEnabled(bool enabled) bool LLVivoxVoiceClient::voiceEnabled() { - return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice"); + static const LLCachedControl<bool> enable_voice_chat(gSavedSettings, "EnableVoiceChat"); + static const LLCachedControl<bool> cmd_line_disable_voice(gSavedSettings, "CmdLineDisableVoice"); + return enable_voice_chat && !cmd_line_disable_voice; } void LLVivoxVoiceClient::setLipSyncEnabled(BOOL enabled) -- GitLab