diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-10-12 18:35:43 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-10-12 19:40:22 +0300 |
commit | 0a2b748705c6e74eaff814d48b8b110c1364b45f (patch) | |
tree | d4408592bc4559147e45bd29a662d6927370f8ce /indra/newview/llappviewer.cpp | |
parent | 1edd38e742b571064c4acece8f29daf25a5e69bb (diff) |
SL-14078 No point in verifying display name cap each frame #2
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 90 |
1 files changed, 43 insertions, 47 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index cffa346d99..384b644dd5 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5168,14 +5168,54 @@ void LLAppViewer::sendLogoutRequest() } } +void LLAppViewer::updateNameLookupUrl() +{ + LLViewerRegion* region = gAgent.getRegion(); + if (!region || !region->capabilitiesReceived()) + { + return; + } + + 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()); + } + + // Error recovery - did we change state? + if (had_capability != have_capability) + { + // name tags are persistant on screen, so make sure they refresh + LLVOAvatar::invalidateNameTags(); + } +} + 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) { - cache_needs_update = true; return; } @@ -5187,54 +5227,10 @@ void LLAppViewer::idleNameCache() // display names or fall back to the old name system. 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. - // 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(); - } - - name_cache->idle(); - } + LLAvatarNameCache::getInstance()->idle(); } // |