More FIRE-35118 - Deferred deletion of notifications. Code and tag cleanup,

work for all types of notifications
meow-7.2.2
simonlsalt 2025-02-03 23:48:01 +00:00
parent 0d357489f6
commit 5fedf54b4d
3 changed files with 43 additions and 41 deletions

View File

@ -37,7 +37,6 @@
#include "llerrorcontrol.h"
#include "lleventtimer.h"
#include "llfile.h"
#include "llfloaternotificationstabbed.h"
#include "llviewertexturelist.h"
#include "llgroupmgr.h"
#include "llagent.h"
@ -118,6 +117,9 @@
// [SL:KB] - Patch: Build-ScriptRecover | Checked: 2011-11-24 (Catznip-3.2.0)
#include "llfloaterscriptrecover.h"
// [/SL:KB]
#include "llfloaternotificationstabbed.h" // <FS:SimonLsAlt/> FIRE-35118 - Add idle() processing to delete notifications
#include "llspellcheck.h"
#include "llscenemonitor.h"
#include "llavatarrenderinfoaccountant.h"
@ -5664,9 +5666,7 @@ void LLAppViewer::idle()
}
}
// <FS:SimonLsAlt> Handle deferred notice deletions
LLFloaterNotificationsTabbed::getInstance()->idle();
// </FS:SimonLsAlt>
LLFloaterNotificationsTabbed::getInstance()->idle(); // <FS:SimonLsAlt/> Handle deferred notice deletions
// Update layonts, handle mouse events, tooltips, e t c
// updateUI() needs to be called even in case viewer disconected

View File

@ -359,63 +359,66 @@ void LLFloaterNotificationsTabbed::getAllItemsOnCurrentTab(std::vector<LLPanel*>
void LLFloaterNotificationsTabbed::closeAllOnCurrentTab()
{
// Need to clear notification channel, to add storable toasts into the list.
// <FS:SimonLsAlt> FIRE-35118 Linden viewer just calls onItemClose() for each item
// which can turn into a lag event several seconds long. Firestorm will queue
// notificatsion UUIDs to close them one by one in the new idle() function below.
mDeleteNotificationsTimer.reset();
// </FS:SimonLsAlt>
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)
{ // Save via UUID instead of pointers to avoid dangling pointers
const LLUUID id = notify_item->getID();
// <FS:SimonLsAlt>
// onItemClose(notify_item);
{ // Put all items into the FIFO with UUID and type
LLUUID id = notify_item->getID();
if (id.notNull())
{
mToastsToGo.push(id); // Add UUID to back of queue
// Add UUID and key to back of queue
mNotificationsToGo.push( {id, notify_item->getNotificationName()} );
}
}
}
LL_INFOS() << "Close all on current tab: " << mDeleteNotificationsTimer.getElapsedTimeF32() << " sec "
<< " to queue " << mToastsToGo.size() << " notices to delete" << LL_ENDL;
<< " to queue " << mNotificationsToGo.size() << " notices to delete" << LL_ENDL;
}
//---------------------------------------------------------------------------------
// <FS:SimonLsAlt> Deferred deletion of notifications
// Firestorm Deferred deletion of notifications FIRE-35118
void LLFloaterNotificationsTabbed::idle()
{
if (!mToastsToGo.empty())
if (!mNotificationsToGo.empty())
{ // If there are any toasts to close, close them one by one
LLUUID toast_id = mToastsToGo.front(); // FIFO queue
mToastsToGo.pop();
std::pair<LLUUID, std::string> pear = mNotificationsToGo.front(); // FIFO queue
mNotificationsToGo.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)
// Find the notice by ID
LLNotificationListItem* item = dynamic_cast<LLNotificationListItem*>(findItemByID(pear.first, pear.second));
if (item)
{
// LL_INFOS() << "Found deferred item to close: " << pear.first << " type " << pear.second << LL_ENDL;
onItemClose(item);
if (mNotificationsToGo.empty())
{
// 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;
LL_INFOS() << "Close all on current tab took " << mDeleteNotificationsTimer.getElapsedTimeF32() << " sec "
<< " to delete all notices " << LL_ENDL;
}
}
else
{
LL_WARNS() << "Unable to find deferred notification with ID: " << pear.first
<< " key " << pear.second << LL_ENDL;
}
// </FS:SimonLsAlt>
}
}
// </FS:SimonLsAlt>
//---------------------------------------------------------------------------------
void LLFloaterNotificationsTabbed::collapseAllOnCurrentTab()

View File

@ -98,9 +98,7 @@ public:
void setSysWellChiclet(LLSysWellChiclet* chiclet);
void closeAll();
// <FS:SimonLsAlt> Deferred deletion of notifications
void idle(); // for deferred deletion with "delete all" operation
// <FS:SimonLsAlt>
void idle(); // <FS:SimonLsAlt/> FIRE-35118 Deferred deletion of notifications
static LLFloaterNotificationsTabbed* getInstance(const LLSD& key = LLSD());
@ -171,10 +169,11 @@ private:
LLButton* mDeleteAllBtn;
LLButton* mCollapseAllBtn;
// <FS:SimonLsAlt> Deferred deletion of notifications
std::queue<LLUUID> mToastsToGo;
LLTimer mDeleteNotificationsTimer; // only for logging, could be removed
// <FS:SimonLsAlt>
// <FS:SimonLsAlt> FIRE-35118 Deferred deletion of notifications
std::queue<std::pair<LLUUID, std::string>> mNotificationsToGo;
LLTimer mDeleteNotificationsTimer; // only for logging, could be removed
// </FS:SimonLsAlt>
};
#endif // LL_FLOATERNOTIFICATIONSTABBED_H