diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-08-14 14:54:29 -0700 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-08-14 14:54:29 -0700 |
commit | 683a96a5f1e9111d62710fe621d52192d34079ed (patch) | |
tree | 6185a07b5c1be5748973f423f156d8916cc8bca6 /indra/newview/llpathfindingobject.cpp | |
parent | 9e2db5a173a0e25001bd330421c8738776410481 (diff) |
PATH-849: Refactoring the behavior after loading the owner name of a pathfinding object into the avatar name cache so that each object can simply update its respective row in the scroll list rather than rebuilding from scratch after all names are loaded.
Diffstat (limited to 'indra/newview/llpathfindingobject.cpp')
-rw-r--r-- | indra/newview/llpathfindingobject.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/indra/newview/llpathfindingobject.cpp b/indra/newview/llpathfindingobject.cpp index 39fc3903b4..95da05740d 100644 --- a/indra/newview/llpathfindingobject.cpp +++ b/indra/newview/llpathfindingobject.cpp @@ -57,7 +57,8 @@ LLPathfindingObject::LLPathfindingObject() mOwnerName(), mAvatarNameCacheConnection(), mIsGroupOwned(false), - mLocation() + mLocation(), + mOwnerNameSignal() { } @@ -70,7 +71,8 @@ LLPathfindingObject::LLPathfindingObject(const std::string &pUUID, const LLSD &p mOwnerName(), mAvatarNameCacheConnection(), mIsGroupOwned(false), - mLocation() + mLocation(), + mOwnerNameSignal() { parseObjectData(pObjectData); } @@ -84,7 +86,8 @@ LLPathfindingObject::LLPathfindingObject(const LLPathfindingObject& pOther) mOwnerName(), mAvatarNameCacheConnection(), mIsGroupOwned(pOther.mIsGroupOwned), - mLocation(pOther.mLocation) + mLocation(pOther.mLocation), + mOwnerNameSignal() { fetchOwnerName(); } @@ -119,6 +122,23 @@ std::string LLPathfindingObject::getOwnerName() const return ownerName; } +LLPathfindingObject::name_connection_t LLPathfindingObject::registerOwnerNameListener(name_callback_t pOwnerNameCallback) +{ + llassert(hasOwner()); + + name_connection_t connection; + if (hasOwnerName()) + { + pOwnerNameCallback(getUUID(), getOwnerName()); + } + else + { + connection = mOwnerNameSignal.connect(pOwnerNameCallback); + } + + return connection; +} + void LLPathfindingObject::parseObjectData(const LLSD &pObjectData) { llassert(pObjectData.has(PATHFINDING_OBJECT_NAME_FIELD)); @@ -161,9 +181,13 @@ void LLPathfindingObject::fetchOwnerName() void LLPathfindingObject::handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName) { llassert(mOwnerUUID == pOwnerUUID); + mOwnerName = pAvatarName; mHasOwnerName = true; + disconnectAvatarNameCacheConnection(); + + mOwnerNameSignal(getUUID(), getOwnerName()); } void LLPathfindingObject::disconnectAvatarNameCacheConnection() |