From 5c277922d7a3a9c4849fc9804a6740f1ecbbdbe6 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Mon, 6 Feb 2023 23:50:38 -0500 Subject: [PATCH] Fix part of stall during snapshot from thousands of findChild calls --- indra/newview/lldebugview.cpp | 2 +- indra/newview/llfloaterimnearbychathandler.cpp | 4 ++-- indra/newview/llfloatersnapshot.cpp | 8 +++++--- indra/newview/llfloatersnapshot.h | 3 +++ indra/newview/llscreenchannel.cpp | 16 +++++++++------- indra/newview/llviewerwindow.cpp | 11 ++++++----- indra/newview/llviewerwindow.h | 5 +++++ 7 files changed, 31 insertions(+), 18 deletions(-) diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index dc1c085c88f..73fbe78b0ce 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -123,7 +123,7 @@ void LLDebugView::draw() { if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } LLRect debug_rect; diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index 38aaa1e8364..6753c037041 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -293,7 +293,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } LLRect channel_rect; mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView); @@ -384,7 +384,7 @@ void LLFloaterIMNearbyChatScreenChannel::arrangeToasts() if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (!getParent()) diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 67ce8c64de3..49f15540fe1 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -195,7 +195,7 @@ void LLFloaterSnapshotBase::ImplBase::updateLayout(LLFloaterSnapshotBase* floate } } - bool use_freeze_frame = floaterp->getChild<LLUICtrl>("freeze_frame_check")->getValue().asBoolean(); + bool use_freeze_frame = floaterp->mFreezeFrameCheck->getValue().asBoolean(); if (use_freeze_frame) { @@ -994,8 +994,9 @@ BOOL LLFloaterSnapshot::postBuild() getChild<LLUICtrl>("layer_types")->setValue("colors"); getChildView("layer_types")->setEnabled(FALSE); - getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); - childSetCommitCallback("freeze_frame_check", ImplBase::onCommitFreezeFrame, this); + mFreezeFrameCheck = getChild<LLUICtrl>("freeze_frame_check"); + mFreezeFrameCheck->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); + mFreezeFrameCheck->setCommitCallback(&ImplBase::onCommitFreezeFrame, this); getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot")); childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this); @@ -1003,6 +1004,7 @@ BOOL LLFloaterSnapshot::postBuild() getChild<LLButton>("retract_btn")->setCommitCallback(boost::bind(&LLFloaterSnapshot::onExtendFloater, this)); getChild<LLButton>("extend_btn")->setCommitCallback(boost::bind(&LLFloaterSnapshot::onExtendFloater, this)); + getChild<LLTextBox>("360_label")->setSoundFlags(LLView::MOUSE_UP); getChild<LLTextBox>("360_label")->setShowCursorHand(false); getChild<LLTextBox>("360_label")->setClickedCallback(boost::bind(&LLFloaterSnapshot::on360Snapshot, this)); diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index efc711758ca..541931cfd5c 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -35,6 +35,7 @@ class LLSpinCtrl; class LLSnapshotLivePreview; class LLToolset; +class LLTextBox; class LLFloaterSnapshotBase : public LLFloater { @@ -72,6 +73,8 @@ class LLFloaterSnapshotBase : public LLFloater LLUICtrl* mThumbnailPlaceholder; LLUICtrl *mRefreshBtn, *mRefreshLabel; LLUICtrl *mSucceessLblPanel, *mFailureLblPanel; + LLUICtrl* mFreezeFrameCheck = nullptr; + LLTextBox* m360Label = nullptr; }; class LLFloaterSnapshotBase::ImplBase diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index d466275ae17..19fc3daef6a 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -53,19 +53,21 @@ LLRect LLScreenChannelBase::getChannelRect() { LL_PROFILE_ZONE_SCOPED; + LLRect channel_rect; + LLRect chiclet_rect; + if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); + //if(!mFloaterSnapRegion) mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); } if (mChicletRegion == NULL) { - mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); + mChicletRegion = gViewerWindow->getChicletContainer(); + //if(!mChicletRegion) mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); } - LLRect channel_rect; - LLRect chiclet_rect; - mFloaterSnapRegion->localRectToScreen(mFloaterSnapRegion->getLocalRect(), &channel_rect); mChicletRegion->localRectToScreen(mChicletRegion->getLocalRect(), &chiclet_rect); @@ -103,12 +105,12 @@ BOOL LLScreenChannelBase::postBuild() { if (mFloaterSnapRegion == NULL) { - mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + mFloaterSnapRegion = gViewerWindow->getFloaterSnapRegion(); } if (mChicletRegion == NULL) { - mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); + mChicletRegion = gViewerWindow->getChicletContainer(); } return TRUE; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 6b22e5c8204..4a9da036a41 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2183,7 +2183,9 @@ void LLViewerWindow::initBase() toolbarp->getCenterLayoutPanel()->setReshapeCallback(boost::bind(&LLFloaterView::setToolbarRect, gFloaterView, _1, _2)); } } - gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle()); + mChicletContainer = getRootView()->getChild<LLPanel>("chiclet_container"); + mFloaterSnapRegion = main_view->getChild<LLView>("floater_snap_region"); + gFloaterView->setFloaterSnapView(mFloaterSnapRegion->getHandle()); gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View"); // Console @@ -2247,12 +2249,11 @@ void LLViewerWindow::initWorldUI() if (!gNonInteractive) { - LLPanel* chiclet_container = getRootView()->getChild<LLPanel>("chiclet_container"); LLChicletBar* chiclet_bar = LLChicletBar::getInstance(); - chiclet_bar->setShape(chiclet_container->getLocalRect()); + chiclet_bar->setShape(mChicletContainer->getLocalRect()); chiclet_bar->setFollowsAll(); - chiclet_container->addChild(chiclet_bar); - chiclet_container->setVisible(TRUE); + mChicletContainer->addChild(chiclet_bar); + mChicletContainer->setVisible(TRUE); } LLRect morph_view_rect = full_window; diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 08c9e8a0b4a..ada10a35dbc 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -435,6 +435,9 @@ class LLViewerWindow final : public LLWindowCallbacks static std::string getLastSnapshotDir(); + LLPanel* getChicletContainer() { return mChicletContainer; } + LLView* getFloaterSnapRegion() { return mFloaterSnapRegion; } + private: bool shouldShowToolTipFor(LLMouseHandler *mh); @@ -506,6 +509,8 @@ class LLViewerWindow final : public LLWindowCallbacks LLHandle<LLView> mLoginPanelHolder; // container for login panel LLPopupView* mPopupView; // container for transient popups + LLView* mFloaterSnapRegion = nullptr; + LLPanel* mChicletContainer = nullptr; LLPanel* mStatusBarContainer = nullptr; LLView* mNavBarBarContainer = nullptr; -- GitLab