Restore cached mute check for improved performance

meow-7.2.2
Ansariel 2016-02-19 22:29:27 +01:00
parent 81d5e6e351
commit d7d4ffb0c4
3 changed files with 30 additions and 6 deletions

View File

@ -5046,7 +5046,7 @@ void LLViewerObject::updateText()
LLVOAvatar* avatar = getAvatar();
if (avatar)
{
mText->setHidden(LLMuteList::getInstance()->isMuted(avatar->getID()));
mText->setHidden(avatar->isInMuteList());
}
LLVector3 up_offset(0,0,0);

View File

@ -717,7 +717,9 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mIsEditingAppearance(FALSE),
mUseLocalAppearance(FALSE),
mLastUpdateRequestCOFVersion(-1),
mLastUpdateReceivedCOFVersion(-1)
mLastUpdateReceivedCOFVersion(-1),
mCachedMuteListUpdateTime(0),
mCachedInMuteList(false)
{
LL_DEBUGS("AvatarRender") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL;
@ -2732,7 +2734,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
}
else
{
is_muted = LLMuteList::getInstance()->isMuted(getID());
is_muted = isInMuteList();
}
bool is_friend = LLAvatarTracker::instance().isBuddy(getID());
bool is_cloud = getIsCloud();
@ -3086,7 +3088,7 @@ void LLVOAvatar::slamPosition()
mRoot->updateWorldMatrixChildren();
}
bool LLVOAvatar::isVisuallyMuted() const
bool LLVOAvatar::isVisuallyMuted()
{
bool muted = false;
@ -3105,7 +3107,7 @@ bool LLVOAvatar::isVisuallyMuted() const
{ // Always want to see this AV as an impostor
muted = true;
}
else if (LLMuteList::getInstance()->isMuted(getID()))
else if (isInMuteList())
{
muted = true;
}
@ -3118,6 +3120,25 @@ bool LLVOAvatar::isVisuallyMuted() const
return muted;
}
bool LLVOAvatar::isInMuteList()
{
bool muted = false;
F64 now = LLFrameTimer::getTotalSeconds();
if (now < mCachedMuteListUpdateTime)
{
muted = mCachedInMuteList;
}
else
{
muted = LLMuteList::getInstance()->isMuted(getID());
const F64 SECONDS_BETWEEN_MUTE_UPDATES = 1;
mCachedMuteListUpdateTime = now + SECONDS_BETWEEN_MUTE_UPDATES;
mCachedInMuteList = muted;
}
return muted;
}
void LLVOAvatar::updateDebugText()
{
// clear debug text

View File

@ -387,7 +387,8 @@ public:
public:
U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0);
bool isVisuallyMuted() const;
bool isVisuallyMuted();
bool isInMuteList();
void forceUpdateVisualMuteSettings();
enum VisualMuteSettings
@ -426,6 +427,8 @@ public:
mutable bool mVisualComplexityStale;
U32 mReportedVisualComplexity; // from other viewers through the simulator
bool mCachedInMuteList;
F64 mCachedMuteListUpdateTime;
VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV