FIRE-35118 - lag event for Clicking "Delete All" for a lot of group notices

master
simonlsalt 2025-02-03 03:20:22 +00:00
parent 640994c740
commit 58d159ed4f
3 changed files with 61 additions and 2 deletions

View File

@ -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()
}
}
// <FS:SimonLsAlt> Handle deferred notice deletions
LLFloaterNotificationsTabbed::getInstance()->idle();
// </FS:SimonLsAlt>
// Update layonts, handle mouse events, tooltips, e t c
// updateUI() needs to be called even in case viewer disconected

View File

@ -359,17 +359,63 @@ void LLFloaterNotificationsTabbed::getAllItemsOnCurrentTab(std::vector<LLPanel*>
void LLFloaterNotificationsTabbed::closeAllOnCurrentTab()
{
// Need to clear notification channel, to add storable toasts into the list.
mDeleteNotificationsTimer.reset();
clearScreenChannels();
std::vector<LLPanel*> items;
getAllItemsOnCurrentTab(items);
std::vector<LLPanel*>::iterator iter = items.begin();
for (; iter != items.end(); ++iter)
{
{ // <FS:SimonLsAlt> 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<LLNotificationListItem*>(*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;
}
//---------------------------------------------------------------------------------
// <FS:SimonLsAlt> 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<std::string> 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<LLNotificationListItem*>(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;
}
}
}
}
// </FS:SimonLsAlt>
//---------------------------------------------------------------------------------
void LLFloaterNotificationsTabbed::collapseAllOnCurrentTab()

View File

@ -98,6 +98,10 @@ public:
void setSysWellChiclet(LLSysWellChiclet* chiclet);
void closeAll();
// <FS:SimonLsAlt> Deferred deletion of notifications
void idle(); // for deferred deletion with "delete all" operation
// <FS:SimonLsAlt>
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;
// <FS:SimonLsAlt> Deferred deletion of notifications
std::queue<LLUUID> mToastsToGo;
LLTimer mDeleteNotificationsTimer; // only for logging, could be removed
// <FS:SimonLsAlt>
};
#endif // LL_FLOATERNOTIFICATIONSTABBED_H