Merge branch 'DRTVWR-516-maint' of https://bitbucket.org/lindenlab/viewer

meow-7.2.2
Ansariel 2021-02-15 10:22:20 +01:00
commit 78daeae740
7 changed files with 43 additions and 13 deletions

View File

@ -138,13 +138,24 @@ LLCoprocedureManager::~LLCoprocedureManager()
close();
}
LLCoprocedureManager::poolPtr_t LLCoprocedureManager::initializePool(const std::string &poolName)
void LLCoprocedureManager::initializePool(const std::string &poolName)
{
poolMap_t::iterator it = mPoolMap.find(poolName);
if (it != mPoolMap.end())
{
// Pools are not supposed to be initialized twice
// Todo: ideally restrict init to STATE_FIRST
LL_ERRS() << "Pool is already present " << poolName << LL_ENDL;
return;
}
// Attempt to look up a pool size in the configuration. If found use that
std::string keyName = "PoolSize" + poolName;
int size = 0;
LL_ERRS_IF(poolName.empty(), "CoprocedureManager") << "Poolname must not be empty" << LL_ENDL;
LL_INFOS("CoprocedureManager") << "Initializing pool " << poolName << LL_ENDL;
if (mPropertyQueryFn)
{
@ -171,8 +182,6 @@ LLCoprocedureManager::poolPtr_t LLCoprocedureManager::initializePool(const std::
bool inserted = mPoolMap.emplace(poolName, pool).second;
LL_ERRS_IF(!inserted, "CoprocedureManager") << "Unable to add pool named \"" << poolName << "\" to map. FATAL!" << LL_ENDL;
return pool;
}
//-------------------------------------------------------------------------
@ -182,21 +191,28 @@ LLUUID LLCoprocedureManager::enqueueCoprocedure(const std::string &pool, const s
// not exist, create it.
poolMap_t::iterator it = mPoolMap.find(pool);
poolPtr_t targetPool = (it != mPoolMap.end()) ? it->second : initializePool(pool);
if (it == mPoolMap.end())
{
// initializing pools in enqueueCoprocedure is not thread safe,
// at the moment pools need to be initialized manually
LL_ERRS() << "Uninitialized pool " << pool << LL_ENDL;
}
poolPtr_t targetPool = it->second;
return targetPool->enqueueCoprocedure(name, proc);
}
void LLCoprocedureManager::setPropertyMethods(SettingQuery_t queryfn, SettingUpdate_t updatefn)
{
// functions to discover and store the pool sizes
// Might be a better idea to make an initializePool(name, size) to init everything externally
mPropertyQueryFn = queryfn;
mPropertyDefineFn = updatefn;
// workaround until we get mutex into initializePool
initializePool("VAssetStorage");
initializePool("Upload");
initializePool("ExpCache"); // <FS:Ansariel> FIRE-30731: ExpCache coroutine pool crash
initializePool("AIS"); // it might be better to have some kind of on-demand initialization for AIS
// "ExpCache" pool gets initialized in LLExperienceCache
// asset storage pool gets initialized in LLViewerAssetStorage
}
//-------------------------------------------------------------------------

View File

@ -79,6 +79,8 @@ public:
void close();
void close(const std::string &pool);
void initializePool(const std::string &poolName);
private:
@ -87,8 +89,6 @@ private:
poolMap_t mPoolMap;
poolPtr_t initializePool(const std::string &poolName);
SettingQuery_t mPropertyQueryFn;
SettingUpdate_t mPropertyDefineFn;
};

View File

@ -114,6 +114,8 @@ void LLExperienceCache::initSingleton()
cache_stream >> (*this);
}
LLCoprocedureManager::instance().initializePool("ExpCache");
LLCoros::instance().launch("LLExperienceCache::idleCoro",
boost::bind(&LLExperienceCache::idleCoro, this));

View File

@ -91,6 +91,7 @@ namespace tut
{
Sync sync;
int foo = 0;
LLCoprocedureManager::instance().initializePool("PoolName");
LLUUID queueId = LLCoprocedureManager::instance().enqueueCoprocedure("PoolName", "ProcName",
[&foo, &sync] (LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t & ptr, const LLUUID & id) {
sync.bump();

View File

@ -1899,8 +1899,11 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI
}
else
{
setEnvironment(ENV_REGION, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset, envinfo->mEnvVersion);
mTrackAltitudes = envinfo->mAltitudes;
// update track selection based on new altitudes
mCurrentTrack = calculateSkyTrackForAltitude(gAgent.getPositionAgent().mV[VZ]);
setEnvironment(ENV_REGION, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset, envinfo->mEnvVersion);
}
LL_DEBUGS("ENVIRONMENT") << "Altitudes set to {" << mTrackAltitudes[0] << ", "<< mTrackAltitudes[1] << ", " << mTrackAltitudes[2] << ", " << mTrackAltitudes[3] << LL_ENDL;
@ -2524,6 +2527,15 @@ void LLEnvironment::onAgentPositionHasChanged(const LLVector3 &localpos)
return;
mCurrentTrack = trackno;
LLViewerRegion* cur_region = gAgent.getRegion();
if (!cur_region || !cur_region->capabilitiesReceived())
{
// Environment not ready, environment will be updated later, don't cause 'blend' yet.
// But keep mCurrentTrack updated in case we won't get new altitudes for some reason
return;
}
for (S32 env = ENV_LOCAL; env < ENV_DEFAULT; ++env)
{
if (mEnvironments[env])

View File

@ -2579,9 +2579,6 @@ bool idle_startup()
display_startup();
//all categories loaded. lets create "My Favorites" category
gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE,true);
// set up callbacks
LL_INFOS() << "Registering Callbacks" << LL_ENDL;
LLMessageSystem* msg = gMessageSystem;

View File

@ -117,6 +117,7 @@ LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *
mCountSucceeded(0),
mTotalBytesFetched(0)
{
LLCoprocedureManager::instance().initializePool(VIEWER_ASSET_STORAGE_CORO_POOL);
}
@ -130,6 +131,7 @@ LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *
mCountSucceeded(0),
mTotalBytesFetched(0)
{
LLCoprocedureManager::instance().initializePool(VIEWER_ASSET_STORAGE_CORO_POOL);
}
LLViewerAssetStorage::~LLViewerAssetStorage()