summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelgrouproles.cpp
diff options
context:
space:
mode:
authorKelly Washington <kelly@lindenlab.com>2012-11-12 14:15:22 -0800
committerKelly Washington <kelly@lindenlab.com>2012-11-12 14:15:22 -0800
commit014edb89e82ef55363c39dd80a6076612db20123 (patch)
treeccff3fcffd89aa3f9be67505e94e1f6e66d832e6 /indra/newview/llpanelgrouproles.cpp
parentb9a92f2b4867e2b3e88bff59de3df6dfed77e746 (diff)
MAINT-1897 Poor performance viewing large group member lists
* Use LLAvatarNameCache in group UI to match what namelists use and prevent double lookups * Remove LLSD -> Prams legacy pattern which is super slow. * Member list on general tab only adds to the list after names are known
Diffstat (limited to 'indra/newview/llpanelgrouproles.cpp')
-rw-r--r--indra/newview/llpanelgrouproles.cpp54
1 files changed, 24 insertions, 30 deletions
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index bbe47ae943..5720168f81 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -29,6 +29,7 @@
#include "llcheckboxctrl.h"
#include "llagent.h"
+#include "llavatarnamecache.h"
#include "llbutton.h"
#include "llfiltereditor.h"
#include "llfloatergroupinvite.h"
@@ -1584,25 +1585,22 @@ void LLPanelGroupMembersSubTab::addMemberToList(LLUUID id, LLGroupMemberData* da
LLUIString donated = getString("donation_area");
donated.setArg("[AREA]", llformat("%d", data->getContribution()));
- LLSD row;
- row["id"] = id;
+ LLNameListCtrl::NameItem item_params;
+ item_params.value = id;
- row["columns"][0]["column"] = "name";
- // value is filled in by name list control
+ item_params.columns.add().column("name").font.name("SANSSERIF_SMALL").style("NORMAL");
- row["columns"][1]["column"] = "donated";
- row["columns"][1]["value"] = donated.getString();
+ item_params.columns.add().column("donated").value(donated.getString())
+ .font.name("SANSSERIF_SMALL").style("NORMAL");
- row["columns"][2]["column"] = "online";
- row["columns"][2]["value"] = data->getOnlineStatus();
- row["columns"][2]["font"] = "SANSSERIF_SMALL";
-
- mMembersList->addElement(row);
+ item_params.columns.add().column("online").value(data->getOnlineStatus())
+ .font.name("SANSSERIF_SMALL").style("NORMAL");
+ mMembersList->addNameItemRow(item_params);
mHasMatch = TRUE;
}
-void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, const LLUUID& id)
+void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLUUID& id, const LLAvatarName& av_name)
{
// Update ID is used to determine whether member whose id is passed
// into onNameCache() was passed after current or previous user-initiated update.
@@ -1612,21 +1610,15 @@ void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, const LLUUI
// we do nothing.
if (mUdpateSessionID != update_id) return;
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
- if (!gdatap)
+ if (!member)
{
- llwarns << "LLPanelGroupMembersSubTab::updateMembers() -- No group data!" << llendl;
return;
}
- std::string fullname;
- gCacheName->getFullName(id, fullname);
-
- LLGroupMemberData* data;
// trying to avoid unnecessary hash lookups
- if (matchesSearchFilter(fullname) && ((data = gdatap->mMembers[id]) != NULL))
+ if (matchesSearchFilter(av_name.getLegacyName()))
{
- addMemberToList(id, data);
+ addMemberToList(id, member);
if(!mMembersList->getEnabled())
{
mMembersList->setEnabled(TRUE);
@@ -1665,18 +1657,20 @@ void LLPanelGroupMembersSubTab::updateMembers()
LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end();
-
- S32 i = 0;
- for( ; mMemberProgress != end && i<UPDATE_MEMBERS_PER_FRAME;
- ++mMemberProgress, ++i)
+
+ LLTimer update_time;
+ update_time.setTimerExpirySec(UPDATE_MEMBERS_SECONDS_PER_FRAME);
+
+ for( ; mMemberProgress != end && !update_time.hasExpired(); ++mMemberProgress)
{
if (!mMemberProgress->second)
continue;
+
// Do filtering on name if it is already in the cache.
- std::string fullname;
- if (gCacheName->getFullName(mMemberProgress->first, fullname))
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(mMemberProgress->first, &av_name))
{
- if (matchesSearchFilter(fullname))
+ if (matchesSearchFilter(av_name.getLegacyName()))
{
addMemberToList(mMemberProgress->first, mMemberProgress->second);
}
@@ -1684,8 +1678,8 @@ void LLPanelGroupMembersSubTab::updateMembers()
else
{
// If name is not cached, onNameCache() should be called when it is cached and add this member to list.
- gCacheName->get(mMemberProgress->first, FALSE, boost::bind(&LLPanelGroupMembersSubTab::onNameCache,
- this, mUdpateSessionID, _1));
+ LLAvatarNameCache::get(mMemberProgress->first, boost::bind(&LLPanelGroupMembersSubTab::onNameCache,
+ this, mUdpateSessionID, mMemberProgress->second, _1, _2));
}
}