SL-14078 No point in verifying display name cap each frame
Convoluted due to multiple workarounds. Might be a good idea to spend some time refactoring this, but for now just trottled checks.meow-7.2.2
parent
1cf3a5c505
commit
fc63aa7424
|
|
@ -549,6 +549,12 @@ void LLAvatarNameCache::idle()
|
|||
eraseUnrefreshed();
|
||||
}
|
||||
|
||||
//static
|
||||
bool LLAvatarNameCache::hasWork()
|
||||
{
|
||||
return sRequestTimer.hasExpired();
|
||||
}
|
||||
|
||||
bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id)
|
||||
{
|
||||
bool isPending = false;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ public:
|
|||
// cache. Called once per frame.
|
||||
void idle();
|
||||
|
||||
static bool hasWork();
|
||||
|
||||
// If name is in cache, returns true and fills in provided LLAvatarName
|
||||
// otherwise returns false.
|
||||
static bool get(const LLUUID& agent_id, LLAvatarName *av_name);
|
||||
|
|
|
|||
|
|
@ -5170,9 +5170,14 @@ void LLAppViewer::sendLogoutRequest()
|
|||
|
||||
void LLAppViewer::idleNameCache()
|
||||
{
|
||||
static bool cache_needs_update = true;
|
||||
// Neither old nor new name cache can function before agent has a region
|
||||
LLViewerRegion* region = gAgent.getRegion();
|
||||
if (!region) return;
|
||||
if (!region)
|
||||
{
|
||||
cache_needs_update = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// deal with any queued name requests and replies.
|
||||
gCacheName->processPending();
|
||||
|
|
@ -5180,47 +5185,56 @@ void LLAppViewer::idleNameCache()
|
|||
// Can't run the new cache until we have the list of capabilities
|
||||
// for the agent region, and can therefore decide whether to use
|
||||
// display names or fall back to the old name system.
|
||||
if (!region->capabilitiesReceived()) return;
|
||||
if (!region->capabilitiesReceived())
|
||||
{
|
||||
cache_needs_update = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Agent may have moved to a different region, so need to update cap URL
|
||||
// for name lookups. Can't do this in the cap grant code, as caps are
|
||||
// granted to neighbor regions before the main agent gets there. Can't
|
||||
// do it in the move-into-region code because cap not guaranteed to be
|
||||
// granted yet, for example on teleport.
|
||||
LLAvatarNameCache *name_cache = LLAvatarNameCache::getInstance();
|
||||
bool had_capability = LLAvatarNameCache::getInstance()->hasNameLookupURL();
|
||||
std::string name_lookup_url;
|
||||
name_lookup_url.reserve(128); // avoid a memory allocation below
|
||||
name_lookup_url = region->getCapability("GetDisplayNames");
|
||||
bool have_capability = !name_lookup_url.empty();
|
||||
if (have_capability)
|
||||
{
|
||||
// we have support for display names, use it
|
||||
U32 url_size = name_lookup_url.size();
|
||||
// capabilities require URLs with slashes before query params:
|
||||
// https://<host>:<port>/cap/<uuid>/?ids=<blah>
|
||||
// but the caps are granted like:
|
||||
// https://<host>:<port>/cap/<uuid>
|
||||
if (url_size > 0 && name_lookup_url[url_size-1] != '/')
|
||||
{
|
||||
name_lookup_url += '/';
|
||||
}
|
||||
name_cache->setNameLookupURL(name_lookup_url);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Display names not available on this region
|
||||
name_cache->setNameLookupURL( std::string() );
|
||||
}
|
||||
// Agent may have moved to a different region, so need to update cap URL
|
||||
// for name lookups. Can't do this in the cap grant code, as caps are
|
||||
// granted to neighbor regions before the main agent gets there. Can't
|
||||
// do it in the move-into-region code because cap not guaranteed to be
|
||||
// granted yet, for example on teleport.
|
||||
// hasWork() is cache's 'idle' timer, 10 updates per second
|
||||
if (LLAvatarNameCache::hasWork() || cache_needs_update)
|
||||
{
|
||||
cache_needs_update = false;
|
||||
LLAvatarNameCache *name_cache = LLAvatarNameCache::getInstance();
|
||||
bool had_capability = name_cache->hasNameLookupURL();
|
||||
std::string name_lookup_url;
|
||||
name_lookup_url.reserve(128); // avoid a memory allocation below
|
||||
name_lookup_url = region->getCapability("GetDisplayNames");
|
||||
bool have_capability = !name_lookup_url.empty();
|
||||
if (have_capability)
|
||||
{
|
||||
// we have support for display names, use it
|
||||
U32 url_size = name_lookup_url.size();
|
||||
// capabilities require URLs with slashes before query params:
|
||||
// https://<host>:<port>/cap/<uuid>/?ids=<blah>
|
||||
// but the caps are granted like:
|
||||
// https://<host>:<port>/cap/<uuid>
|
||||
if (url_size > 0 && name_lookup_url[url_size - 1] != '/')
|
||||
{
|
||||
name_lookup_url += '/';
|
||||
}
|
||||
name_cache->setNameLookupURL(name_lookup_url);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Display names not available on this region
|
||||
name_cache->setNameLookupURL(std::string());
|
||||
}
|
||||
|
||||
// Error recovery - did we change state?
|
||||
if (had_capability != have_capability)
|
||||
{
|
||||
// name tags are persistant on screen, so make sure they refresh
|
||||
LLVOAvatar::invalidateNameTags();
|
||||
}
|
||||
// Error recovery - did we change state?
|
||||
if (had_capability != have_capability)
|
||||
{
|
||||
// name tags are persistant on screen, so make sure they refresh
|
||||
LLVOAvatar::invalidateNameTags();
|
||||
}
|
||||
|
||||
name_cache->idle();
|
||||
name_cache->idle();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in New Issue