From 58d159ed4fcb482842e2bf9bffef665cddaacb54 Mon Sep 17 00:00:00 2001 From: simonlsalt Date: Mon, 3 Feb 2025 03:20:22 +0000 Subject: [PATCH] FIRE-35118 - lag event for Clicking "Delete All" for a lot of group notices --- indra/newview/llappviewer.cpp | 4 ++ .../newview/llfloaternotificationstabbed.cpp | 50 ++++++++++++++++++- indra/newview/llfloaternotificationstabbed.h | 9 ++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 8db746da1f..535202633e 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -37,6 +37,7 @@ #include "llerrorcontrol.h" #include "lleventtimer.h" #include "llfile.h" +#include "llfloaternotificationstabbed.h" #include "llviewertexturelist.h" #include "llgroupmgr.h" #include "llagent.h" @@ -5663,6 +5664,9 @@ void LLAppViewer::idle() } } + // Handle deferred notice deletions + LLFloaterNotificationsTabbed::getInstance()->idle(); + // // Update layonts, handle mouse events, tooltips, e t c // updateUI() needs to be called even in case viewer disconected diff --git a/indra/newview/llfloaternotificationstabbed.cpp b/indra/newview/llfloaternotificationstabbed.cpp index 41ef627f7d..78ffcceada 100644 --- a/indra/newview/llfloaternotificationstabbed.cpp +++ b/indra/newview/llfloaternotificationstabbed.cpp @@ -359,17 +359,63 @@ void LLFloaterNotificationsTabbed::getAllItemsOnCurrentTab(std::vector void LLFloaterNotificationsTabbed::closeAllOnCurrentTab() { // Need to clear notification channel, to add storable toasts into the list. + mDeleteNotificationsTimer.reset(); + clearScreenChannels(); std::vector items; getAllItemsOnCurrentTab(items); std::vector::iterator iter = items.begin(); for (; iter != items.end(); ++iter) - { + { // Linden viewer just calls onItemClose() for each item + // which can turn into a lag event several seconds long. Firestorm will queue + // notification UUIDs to close them one by one in the new idle() function. + + // Put all items into the FIFO to close them one by one LLNotificationListItem* notify_item = dynamic_cast(*iter); if (notify_item) - onItemClose(notify_item); + { // Save via UUID instead of pointers to avoid dangling pointers + const LLUUID id = notify_item->getID(); + if (id.notNull()) + { + mToastsToGo.push(id); // Add UUID to back of queue + } + } + } + LL_INFOS() << "Close all on current tab: " << mDeleteNotificationsTimer.getElapsedTimeF32() << " sec " + << " to queue " << mToastsToGo.size() << " notices to delete" << LL_ENDL; +} + + +//--------------------------------------------------------------------------------- +// Deferred deletion of notifications +void LLFloaterNotificationsTabbed::idle() +{ + if (!mToastsToGo.empty()) + { // If there are any toasts to close, close them one by one + LLUUID toast_id = mToastsToGo.front(); // FIFO queue + mToastsToGo.pop(); + + // Should just be "GroupNotice" but use the API to get the list of types + std::set notice_types = LLGroupNoticeNotificationListItem::getTypes(); + for (auto type_it = notice_types.begin(); type_it != notice_types.end(); ++type_it) + { // Find the group notice by ID + LLNotificationListItem* item = dynamic_cast(findItemByID(toast_id, *type_it)); + if (item) + { + // LL_INFOS() << "Found deferred item to close: " << toast_id << " type " << *type_it << LL_ENDL; + onItemClose(item); + + if (mToastsToGo.empty()) + { + LL_INFOS() << "Close all on current tab took " << mDeleteNotificationsTimer.getElapsedTimeF32() << " sec " + << " to delete all notices " << LL_ENDL; + } + break; + } + } } } +// //--------------------------------------------------------------------------------- void LLFloaterNotificationsTabbed::collapseAllOnCurrentTab() diff --git a/indra/newview/llfloaternotificationstabbed.h b/indra/newview/llfloaternotificationstabbed.h index 87e880c8d2..f5b4f017a7 100644 --- a/indra/newview/llfloaternotificationstabbed.h +++ b/indra/newview/llfloaternotificationstabbed.h @@ -98,6 +98,10 @@ public: void setSysWellChiclet(LLSysWellChiclet* chiclet); void closeAll(); + // Deferred deletion of notifications + void idle(); // for deferred deletion with "delete all" operation + // + static LLFloaterNotificationsTabbed* getInstance(const LLSD& key = LLSD()); // size constants for the window and for its elements @@ -166,6 +170,11 @@ private: LLTabContainer* mNotificationsTabContainer; LLButton* mDeleteAllBtn; LLButton* mCollapseAllBtn; + + // Deferred deletion of notifications + std::queue mToastsToGo; + LLTimer mDeleteNotificationsTimer; // only for logging, could be removed + // }; #endif // LL_FLOATERNOTIFICATIONSTABBED_H