diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 3 | ||||
-rw-r--r-- | indra/newview/llavatarrenderinfoaccountant.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lldrawpoolbump.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 4 | ||||
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 50 |
9 files changed, 55 insertions, 36 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 90f9b38f2d..c966f9cbcc 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5200,6 +5200,11 @@ void LLAppViewer::updateNameLookupUrl(const LLViewerRegion * regionp) } } +void LLAppViewer::postToMainCoro(const LL::WorkQueue::Work& work) +{ + gMainloopWork.post(work); +} + void LLAppViewer::idleNameCache() { // Neither old nor new name cache can function before agent has a region diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 9352dba06d..92976a70af 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -226,6 +226,9 @@ public: void updateNameLookupUrl(const LLViewerRegion* regionp); + // post given work to the "mainloop" work queue for handling on the main thread + void postToMainCoro(const LL::WorkQueue::Work& work); + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual void initLoggingAndGetLastDuration(); // Initialize log files, logging system diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index b95b971890..ba9ba4dc64 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -236,8 +236,6 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U !avatar->isControlAvatar() && // Not part of an animated object avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region { - avatar->calculateUpdateRenderComplexity(); // Make sure the numbers are up-to-date - LLSD info = LLSD::emptyMap(); U32 avatar_complexity = avatar->getVisualComplexity(); if (avatar_complexity > 0) diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 24df11c158..518310476b 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -699,6 +699,8 @@ void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32 void LLBumpImageList::updateImages() { + llassert(LLCoros::on_main_thread_main_coro()); // This code is not thread safe + for (bump_image_map_t::iterator iter = mBrightnessEntries.begin(); iter != mBrightnessEntries.end(); ) { LLViewerTexture* image = iter->second; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index a0324ca82a..486b652f07 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -334,10 +334,18 @@ void update_texture_fetch() void set_flags_and_update_appearance() { - LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); - LLAppearanceMgr::instance().updateAppearanceFromCOF(true, true, no_op); + // this may be called from a coroutine but has many side effects + // in non-thread-safe classes, post to main loop + auto work = []() + { + LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); + LLAppearanceMgr::instance().updateAppearanceFromCOF(true, true, no_op); + + LLInventoryModelBackgroundFetch::instance().start(); + }; + + LLAppViewer::instance()->postToMainCoro(work); - LLInventoryModelBackgroundFetch::instance().start(); } // Returns false to skip other idle processing. Should only return diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 02108e861a..85891744ef 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1667,7 +1667,7 @@ void LLViewerMediaImpl::destroyMediaSource() cancelMimeTypeProbe(); { - LLMutexLock lock(&mLock); // Delay tear-down while bg thread is updating + LLCoros::LockType lock(mLock); // Delay tear-down while bg thread is updating if(mMediaSource) { mMediaSource->setDeleteOK(true) ; @@ -2968,7 +2968,7 @@ bool LLViewerMediaImpl::preMediaTexUpdate(LLViewerMediaTexture*& media_tex, U8*& void LLViewerMediaImpl::doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* data, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool sync) { LL_PROFILE_ZONE_SCOPED_CATEGORY_MEDIA; - LLMutexLock lock(&mLock); // don't allow media source tear-down during update + LLCoros::LockType lock(mLock); // don't allow media source tear-down during update // wrap "data" in an LLImageRaw but do NOT make a copy LLPointer<LLImageRaw> raw = new LLImageRaw(data, media_tex->getWidth(), media_tex->getHeight(), media_tex->getComponents(), true); diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 03899b6b8f..378297bf91 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -182,7 +182,7 @@ private: // Implementation functions not exported into header file class LLViewerMediaImpl - : public LLMouseHandler, public LLRefCount, public LLPluginClassMediaOwner, public LLViewerMediaEventEmitter, public LLEditMenuHandler + : public LLMouseHandler, public LLThreadSafeRefCount, public LLPluginClassMediaOwner, public LLViewerMediaEventEmitter, public LLEditMenuHandler { LOG_CLASS(LLViewerMediaImpl); public: @@ -432,7 +432,7 @@ private: private: // a single media url with some data and an impl. std::shared_ptr<LLPluginClassMedia> mMediaSource; - LLMutex mLock; + LLCoros::Mutex mLock; F64 mZoomFactor; LLUUID mTextureId; bool mMovieImageHasMips; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 29dce088f5..210d5f84bd 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2498,11 +2498,8 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) } }; - auto workqueue = LL::WorkQueue::getInstance("mainloop"); - if (workqueue) - { - LL::WorkQueue::postMaybe(workqueue, work); - } + + LLAppViewer::instance()->postToMainCoro(work); } //this is called when the parent is not cacheable. diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 310c9ee297..9a0aae944c 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -6437,37 +6437,43 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta } } } - + LL_DEBUGS("Voice") << " " << LLVoiceClientStatusObserver::status2string(status) << ", session URI " << getAudioSessionURI() << ", proximal is " << inSpatialChannel() << LL_ENDL; - for (status_observer_set_t::iterator it = mStatusObservers.begin(); - it != mStatusObservers.end(); - ) - { - LLVoiceClientStatusObserver* observer = *it; - observer->onChange(status, getAudioSessionURI(), inSpatialChannel()); - // In case onError() deleted an entry. - it = mStatusObservers.upper_bound(observer); - } + // this function is called from a coroutine, shuttle application hook back to main loop + auto work = [=]() + { + for (status_observer_set_t::iterator it = mStatusObservers.begin(); + it != mStatusObservers.end(); + ) + { + LLVoiceClientStatusObserver* observer = *it; + observer->onChange(status, getAudioSessionURI(), inSpatialChannel()); + // In case onError() deleted an entry. + it = mStatusObservers.upper_bound(observer); + } - // skipped to avoid speak button blinking - if ( status != LLVoiceClientStatusObserver::STATUS_JOINING - && status != LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL - && status != LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED) - { - bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); + // skipped to avoid speak button blinking + if (status != LLVoiceClientStatusObserver::STATUS_JOINING + && status != LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL + && status != LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED) + { + bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); - gAgent.setVoiceConnected(voice_status); + gAgent.setVoiceConnected(voice_status); - if (voice_status) - { - LLFirstUse::speak(true); - } - } + if (voice_status) + { + LLFirstUse::speak(true); + } + } + }; + + LLAppViewer::instance()->postToMainCoro(work); } void LLVivoxVoiceClient::addObserver(LLFriendObserver* observer) |