MAINT-5250 Viewer should handle large number of calling cards better

master
andreykproductengine 2015-06-16 20:18:27 +03:00
parent 91c45fa3ba
commit 11b48840c7
3 changed files with 26 additions and 3 deletions

View File

@ -4923,6 +4923,7 @@ void LLAppViewer::idle()
gIdleCallbacks.callFunctions();
gInventory.idleNotifyObservers();
LLAvatarTracker::instance().idleNotifyObservers();
}
// Metrics logging (LLViewerAssetStats, etc.)

View File

@ -97,7 +97,8 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id,
LLAvatarTracker::LLAvatarTracker() :
mTrackingData(NULL),
mTrackedAgentValid(false),
mModifyMask(0x0)
mModifyMask(0x0),
mIsNotifyObservers(FALSE)
{
}
@ -272,7 +273,7 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds)
<< "]" << LL_ENDL;
}
}
notifyObservers();
// do not notify observers here - list can be large so let it be done on idle.
return new_buddy_count;
}
@ -473,8 +474,25 @@ void LLAvatarTracker::removeObserver(LLFriendObserver* observer)
mObservers.end());
}
void LLAvatarTracker::idleNotifyObservers()
{
if (mModifyMask == LLFriendObserver::NONE && mChangedBuddyIDs.size() == 0)
{
return;
}
notifyObservers();
}
void LLAvatarTracker::notifyObservers()
{
if (mIsNotifyObservers)
{
// Don't allow multiple calls.
// new masks and ids will be processed later from idle.
return;
}
mIsNotifyObservers = TRUE;
observer_list_t observers(mObservers);
observer_list_t::iterator it = observers.begin();
observer_list_t::iterator end = observers.end();
@ -490,6 +508,7 @@ void LLAvatarTracker::notifyObservers()
mModifyMask = LLFriendObserver::NONE;
mChangedBuddyIDs.clear();
mIsNotifyObservers = FALSE;
}
void LLAvatarTracker::addParticularFriendObserver(const LLUUID& buddy_id, LLFriendObserver* observer)
@ -531,7 +550,7 @@ void LLAvatarTracker::notifyParticularFriendObservers(const LLUUID& buddy_id)
// store flag for change
// and id of object change applies to
void LLAvatarTracker::addChangedMask(U32 mask, const LLUUID& referent)
{
{
mModifyMask |= mask;
if (referent.notNull())
{

View File

@ -143,6 +143,7 @@ public:
// observers left behind.
void addObserver(LLFriendObserver* observer);
void removeObserver(LLFriendObserver* observer);
void idleNotifyObservers();
void notifyObservers();
// Observers interested in updates of a particular avatar.
@ -209,6 +210,8 @@ private:
LLAvatarTracker(const LLAvatarTracker&);
bool operator==(const LLAvatarTracker&);
BOOL mIsNotifyObservers;
public:
// don't you dare create or delete this object
LLAvatarTracker();