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 | |
parent | 1edd38e742b571064c4acece8f29daf25a5e69bb (diff) |
SL-14078 No point in verifying display name cap each frame #2
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmessage/llavatarnamecache.cpp | 6 | ||||
-rw-r--r-- | indra/llmessage/llavatarnamecache.h | 2 | ||||
-rw-r--r-- | indra/newview/llagent.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llagent.h | 2 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 90 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 4 |
6 files changed, 62 insertions, 57 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 756fb940aa..7380df041d 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -549,12 +549,6 @@ void LLAvatarNameCache::idle() eraseUnrefreshed(); } -//static -bool LLAvatarNameCache::hasWork() -{ - return sRequestTimer.hasExpired(); -} - bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id) { bool isPending = false; diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index 04400490c7..549d1703fa 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -62,8 +62,6 @@ 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); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 166c2d67c8..04ff0e627e 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -858,6 +858,18 @@ boost::signals2::connection LLAgent::addParcelChangedCallback(parcel_changed_cal return mParcelChangedSignal.connect(cb); } +// static +void LLAgent::capabilityReceivedCallback(const LLUUID ®ion_id) +{ + LLViewerRegion* region = gAgent.getRegion(); + if (region && region->getRegionID() == region_id) + { + region->requestSimulatorFeatures(); + LLAppViewer::instance()->updateNameLookupUrl(); + } +} + + //----------------------------------------------------------------------------- // setRegion() //----------------------------------------------------------------------------- @@ -899,10 +911,11 @@ void LLAgent::setRegion(LLViewerRegion *regionp) if (regionp->capabilitiesReceived()) { regionp->requestSimulatorFeatures(); + LLAppViewer::instance()->updateNameLookupUrl(); } else { - regionp->setCapabilitiesReceivedCallback(boost::bind(&LLViewerRegion::requestSimulatorFeatures, regionp)); + regionp->setCapabilitiesReceivedCallback(LLAgent::capabilityReceivedCallback); } } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 88cce0b911..78303ee560 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -261,6 +261,8 @@ public: boost::signals2::connection addParcelChangedCallback(parcel_changed_callback_t); private: + static void capabilityReceivedCallback(const LLUUID ®ion_id); + typedef boost::signals2::signal<void()> parcel_changed_signal_t; parcel_changed_signal_t mParcelChangedSignal; 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(); } // diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 8f0f54de3b..4352905f7d 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -205,7 +205,9 @@ public: // llcorehttp init/shutdown/config information. LLAppCoreHttp & getAppCoreHttp() { return mAppCoreHttp; } - + + void updateNameLookupUrl(); + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual void initLoggingAndGetLastDuration(); // Initialize log files, logging system |