summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-10-09 21:53:53 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-10-09 21:53:53 +0300
commitfc63aa74247b9a62871cf2ee929457d68bfdf63d (patch)
tree3b4f7b6fb63fc6fea9032fa2ac781a8164e0185c /indra/newview
parent1cf3a5c505f1705a9d7169570799bda55f76e675 (diff)
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.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp94
1 files changed, 54 insertions, 40 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index ee055c48d4..cffa346d99 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -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;
-
- // 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() );
- }
+ if (!region->capabilitiesReceived())
+ {
+ cache_needs_update = true;
+ return;
+ }
- // Error recovery - did we change state?
- if (had_capability != have_capability)
- {
- // name tags are persistant on screen, so make sure they refresh
- LLVOAvatar::invalidateNameTags();
- }
+ // 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());
+ }
- name_cache->idle();
+ // 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();
+ }
}
//