diff options
author | Dave Parks <davep@lindenlab.com> | 2012-11-08 13:05:29 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2012-11-08 13:05:29 -0600 |
commit | c431ddf629b7f1149c44b2063d216dd34bcd2b12 (patch) | |
tree | 7c625873abf2ad80fc25e90e073ff0fcc2e619ab /indra/newview/llnotificationstorage.cpp | |
parent | b76b81ff811014012856f58970c1aac093507557 (diff) | |
parent | 8c8c2f3b940059f82777c9b0b9f40e4d2f7bc6ab (diff) |
Automated merge with http://bitbucket.org/lindenlab/viewer-development
Diffstat (limited to 'indra/newview/llnotificationstorage.cpp')
-rw-r--r-- | indra/newview/llnotificationstorage.cpp | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index fb1adc7ddf..4cad96fdc7 100644 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -84,6 +84,11 @@ bool LLPersistentNotificationStorage::onPersistentChannelChanged(const LLSD& pay return false; } +// Storing or loading too many persistent notifications will severely hurt +// viewer load times, possibly to the point of failing to log in. Example case +// from MAINT-994 is 821 notifications. +static const S32 MAX_PERSISTENT_NOTIFICATIONS = 250; + void LLPersistentNotificationStorage::saveNotifications() { // TODO - think about save optimization. @@ -114,6 +119,13 @@ void LLPersistentNotificationStorage::saveNotifications() } data.append(notification->asLLSD()); + + if (data.size() >= MAX_PERSISTENT_NOTIFICATIONS) + { + llwarns << "Too many persistent notifications." + << " Saved " << MAX_PERSISTENT_NOTIFICATIONS << " of " << history_channel->size() << " persistent notifications." << llendl; + break; + } } LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); @@ -124,9 +136,6 @@ void LLPersistentNotificationStorage::loadNotifications() { LLResponderRegistry::registerResponders(); - LLNotifications::instance().getChannel("Persistent")-> - connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1)); - llifstream notify_file(mFileName.c_str()); if (!notify_file.is_open()) { @@ -158,29 +167,48 @@ void LLPersistentNotificationStorage::loadNotifications() findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); LLNotifications& instance = LLNotifications::instance(); - + S32 processed_notifications = 0; for (LLSD::array_const_iterator notification_it = data.beginArray(); notification_it != data.endArray(); ++notification_it) { LLSD notification_params = *notification_it; - LLNotificationPtr notification(new LLNotification(notification_params)); - LLNotificationResponderPtr responder(LLResponderRegistry:: - createResponder(notification_params["name"], notification_params["responder"])); - notification->setResponseFunctor(responder); + if (instance.templateExists(notification_params["name"].asString())) + { + LLNotificationPtr notification(new LLNotification(notification_params)); - instance.add(notification); + LLNotificationResponderPtr responder(LLResponderRegistry:: + createResponder(notification_params["name"], notification_params["responder"])); + notification->setResponseFunctor(responder); - // hide script floaters so they don't confuse the user and don't overlap startup toast - LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false); + instance.add(notification); - if(notification_channel) + // hide script floaters so they don't confuse the user and don't overlap startup toast + LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false); + + if(notification_channel) + { + // hide saved toasts so they don't confuse the user + notification_channel->hideToast(notification->getID()); + } + } + else + { + llwarns << "Failed to find template for persistent notification " << notification_params["name"].asString() << llendl; + } + + ++processed_notifications; + if (processed_notifications >= MAX_PERSISTENT_NOTIFICATIONS) { - // hide saved toasts so they don't confuse the user - notification_channel->hideToast(notification->getID()); + llwarns << "Too many persistent notifications." + << " Processed " << MAX_PERSISTENT_NOTIFICATIONS << " of " << data.size() << " persistent notifications." << llendl; + break; } } + + LLNotifications::instance().getChannel("Persistent")-> + connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1)); } ////////////////////////////////////////////////////////////////////////// |