summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llthread.h11
-rw-r--r--indra/llmessage/llcurl.cpp54
-rwxr-xr-x[-rw-r--r--]indra/newview/llavatariconctrl.cpp3
-rw-r--r--indra/newview/llfasttimerview.cpp2
-rw-r--r--indra/newview/llviewertexture.cpp47
5 files changed, 67 insertions, 50 deletions
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h
index 40291a2569..b0a1c9e12b 100644
--- a/indra/llcommon/llthread.h
+++ b/indra/llcommon/llthread.h
@@ -187,11 +187,18 @@ public:
LLMutexLock(LLMutex* mutex)
{
mMutex = mutex;
- mMutex->lock();
+
+ if(mMutex)
+ {
+ mMutex->lock();
+ }
}
~LLMutexLock()
{
- mMutex->unlock();
+ if(mMutex)
+ {
+ mMutex->unlock();
+ }
}
private:
LLMutex* mMutex;
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index ce0632668c..964580fc3f 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -585,37 +585,30 @@ void LLCurl::Multi::unlock()
void LLCurl::Multi::markDead()
{
- if(mDeletionMutexp)
- {
- mDeletionMutexp->lock() ;
- }
-
+ LLMutexLock lock(mDeletionMutexp) ;
+
mDead = TRUE ;
-
- if(mDeletionMutexp)
- {
- mDeletionMutexp->unlock() ;
- }
}
void LLCurl::Multi::setState(LLCurl::Multi::ePerformState state)
{
- lock() ;
+ LLMutexLock lock(mMutexp) ;
+
mState = state ;
if(mState == STATE_READY)
{
LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_NORMAL) ;
}
- unlock() ;
}
LLCurl::Multi::ePerformState LLCurl::Multi::getState()
{
ePerformState state ;
- lock() ;
- state = mState ;
- unlock() ;
+ {
+ LLMutexLock lock(mMutexp) ;
+ state = mState ;
+ }
return state ;
}
@@ -635,13 +628,15 @@ bool LLCurl::Multi::waitToComplete()
bool completed ;
- lock() ;
- completed = (STATE_COMPLETED == mState) ;
- if(!completed)
{
- LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ;
+ LLMutexLock lock(mMutexp) ;
+
+ completed = (STATE_COMPLETED == mState) ;
+ if(!completed)
+ {
+ LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ;
+ }
}
- unlock() ;
return completed;
}
@@ -655,10 +650,8 @@ CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue)
//return true if dead
bool LLCurl::Multi::doPerform()
{
- if(mDeletionMutexp)
- {
- mDeletionMutexp->lock() ;
- }
+ LLMutexLock lock(mDeletionMutexp) ;
+
bool dead = mDead ;
if(mDead)
@@ -675,6 +668,8 @@ bool LLCurl::Multi::doPerform()
call_count < MULTI_PERFORM_CALL_REPEAT;
call_count++)
{
+ LLMutexLock lock(mMutexp) ;
+
CURLMcode code = curl_multi_perform(mCurlMultiHandle, &q);
if (CURLM_CALL_MULTI_PERFORM != code || q == 0)
{
@@ -688,11 +683,6 @@ bool LLCurl::Multi::doPerform()
setState(STATE_COMPLETED) ;
}
- if(mDeletionMutexp)
- {
- mDeletionMutexp->unlock() ;
- }
-
return dead ;
}
@@ -764,6 +754,8 @@ LLCurl::Easy* LLCurl::Multi::allocEasy()
bool LLCurl::Multi::addEasy(Easy* easy)
{
+ LLMutexLock lock(mMutexp) ;
+
CURLMcode mcode = curl_multi_add_handle(mCurlMultiHandle, easy->getCurlHandle());
check_curl_multi_code(mcode);
//if (mcode != CURLM_OK)
@@ -776,6 +768,8 @@ bool LLCurl::Multi::addEasy(Easy* easy)
void LLCurl::Multi::easyFree(Easy* easy)
{
+ LLMutexLock lock(mMutexp) ;
+
mEasyActiveList.erase(easy);
mEasyActiveMap.erase(easy->getCurlHandle());
if (mEasyFreeList.size() < EASY_HANDLE_POOL_SIZE)
@@ -791,6 +785,8 @@ void LLCurl::Multi::easyFree(Easy* easy)
void LLCurl::Multi::removeEasy(Easy* easy)
{
+ LLMutexLock lock(mMutexp) ;
+
check_curl_multi_code(curl_multi_remove_handle(mCurlMultiHandle, easy->getCurlHandle()));
easyFree(easy);
}
diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp
index 42e7decec1..b539ac38ed 100644..100755
--- a/indra/newview/llavatariconctrl.cpp
+++ b/indra/newview/llavatariconctrl.cpp
@@ -75,6 +75,9 @@ void LLAvatarIconIDCache::load ()
LLUUID icon_id;
LLDate date;
+ if (line.length()<=uuid_len*2)
+ continue; // short line, bail out to prevent substr calls throwing exception.
+
std::string avatar_id_str = line.substr(0,uuid_len);
std::string icon_id_str = line.substr(uuid_len,uuid_len);
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 065dc5f4be..233038daba 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -105,6 +105,7 @@ void LLFastTimerView::onPause()
if (!LLFastTimer::sPauseHistory)
{
mScrollIndex = 0;
+ LLFastTimer::sResetHistory = true;
getChild<LLButton>("pause_btn")->setLabel(getString("pause"));
}
else
@@ -591,6 +592,7 @@ void LLFastTimerView::draw()
{
mAvgCountTotal = ticks;
mMaxCountTotal = ticks;
+ LLFastTimer::sResetHistory = false;
}
}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 1863992a22..2e1dc95483 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -422,10 +422,18 @@ static LLFastTimer::DeclareTimer FTM_TEXTURE_MEMORY_CHECK("Memory Check");
//static
bool LLViewerTexture::isMemoryForTextureLow()
{
+ const F32 WAIT_TIME = 1.0f ; //second
LLFastTimer t(FTM_TEXTURE_MEMORY_CHECK);
+ static LLFrameTimer timer ;
- const static S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB
- const static S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB
+ if(timer.getElapsedTimeF32() < WAIT_TIME) //call this once per second.
+ {
+ return false;
+ }
+ timer.reset() ;
+
+ const S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB
+ const S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB
bool low_mem = false ;
if (gGLManager.mHasATIMemInfo)
@@ -437,6 +445,15 @@ bool LLViewerTexture::isMemoryForTextureLow()
{
low_mem = true ;
}
+
+ if(!low_mem) //check main memory, only works for windows.
+ {
+ LLMemory::updateMemoryInfo() ;
+ if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy)
+ {
+ low_mem = true ;
+ }
+ }
}
#if 0 //ignore nVidia cards
else if (gGLManager.mHasNVXMemInfo)
@@ -449,16 +466,7 @@ bool LLViewerTexture::isMemoryForTextureLow()
low_mem = true ;
}
}
-#endif
-
- if(!low_mem) //check main memory, only works for windows.
- {
- LLMemory::updateMemoryInfo() ;
- if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy)
- {
- low_mem = true ;
- }
- }
+#endif
return low_mem ;
}
@@ -2321,18 +2329,18 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s
bool LLViewerFetchedTexture::doLoadedCallbacks()
{
- static const F32 MAX_INACTIVE_TIME = 120.f ; //seconds
+ static const F32 MAX_INACTIVE_TIME = 900.f ; //seconds
- if(mPauseLoadedCallBacks)
- {
- destroyRawImage();
- return false; //paused
- }
if (mNeedsCreateTexture)
{
return false;
}
- if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME)
+ if(mPauseLoadedCallBacks)
+ {
+ destroyRawImage();
+ return false; //paused
+ }
+ if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME && !mIsFetching)
{
clearCallbackEntryList() ; //remove all callbacks.
return false ;
@@ -2355,6 +2363,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
// Remove ourself from the global list of textures with callbacks
gTextureList.mCallbackList.erase(this);
+ return false ;
}
S32 gl_discard = getDiscardLevel();