summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2015-06-16 20:18:27 +0300
committerandreykproductengine <akleshchev@productengine.com>2015-06-16 20:18:27 +0300
commit11b48840c7835d6849ea65cf4e88ecda329d0db2 (patch)
tree4abd1a0600b4db2527f2b61e07f5ee85368a885d
parent91c45fa3ba456f4d9ffcf59d511657172b81ae52 (diff)
MAINT-5250 Viewer should handle large number of calling cards better
-rwxr-xr-xindra/newview/llappviewer.cpp1
-rwxr-xr-xindra/newview/llcallingcard.cpp25
-rwxr-xr-xindra/newview/llcallingcard.h3
3 files changed, 26 insertions, 3 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index abbfe25fe2..2bb154ca04 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4923,6 +4923,7 @@ void LLAppViewer::idle()
gIdleCallbacks.callFunctions();
gInventory.idleNotifyObservers();
+ LLAvatarTracker::instance().idleNotifyObservers();
}
// Metrics logging (LLViewerAssetStats, etc.)
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index b6c5496c17..f79d1aa609 100755
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -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())
{
diff --git a/indra/newview/llcallingcard.h b/indra/newview/llcallingcard.h
index 6e5fc01cd8..1f819a42fd 100755
--- a/indra/newview/llcallingcard.h
+++ b/indra/newview/llcallingcard.h
@@ -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();