summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2012-04-12 15:50:25 -0600
committerXiaohong Bao <bao@lindenlab.com>2012-04-12 15:50:25 -0600
commit0a42495906fdc56eeb118ac41ffa9ebcadc8de17 (patch)
tree5906d53ff8d0ca460d98a678fd730d9e4ba33944 /indra/newview
parent3c0e4e432461122ed9efe3bb6157247a34d7911b (diff)
for SH-3074: clear ghost and stale texture fetching requests in time
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/lltexturefetch.cpp11
-rw-r--r--indra/newview/llviewertexture.cpp11
-rw-r--r--indra/newview/llviewertexture.h1
-rw-r--r--indra/newview/llviewertexturelist.cpp25
-rw-r--r--indra/newview/llviewertexturelist.h2
5 files changed, 50 insertions, 0 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 9ed6537b7a..3d8424e274 100755
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -845,6 +845,8 @@ void LLTextureFetchWorker::startWork(S32 param)
// Called from LLWorkerThread::processRequest()
bool LLTextureFetchWorker::doWork(S32 param)
{
+ static const F32 FETCHING_TIMEOUT = 120.f;//seconds
+
LLMutexLock lock(&mWorkMutex);
if ((mFetcher->isQuitting() || getFlags(LLWorkerClass::WCF_DELETE_REQUESTED)))
@@ -1187,6 +1189,8 @@ bool LLTextureFetchWorker::doWork(S32 param)
bool res = false;
if (!mUrl.empty())
{
+ mRequestedTimer.reset();
+
mLoaded = FALSE;
mGetStatus = 0;
mGetReason.clear();
@@ -1345,6 +1349,13 @@ bool LLTextureFetchWorker::doWork(S32 param)
}
else
{
+ if(FETCHING_TIMEOUT < mRequestedTimer.getElapsedTimeF32())
+ {
+ //timeout, abort.
+ mState = DONE;
+ return true;
+ }
+
setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority);
return false;
}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 2efc9ad4d0..09f3db60f2 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -2129,6 +2129,17 @@ bool LLViewerFetchedTexture::updateFetch()
return mIsFetching ? true : false;
}
+void LLViewerFetchedTexture::forceToDeleteRequest()
+{
+ if (mHasFetcher)
+ {
+ LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
+ mHasFetcher = FALSE;
+ mIsFetching = FALSE ;
+ resetTextureStats();
+ }
+}
+
void LLViewerFetchedTexture::setIsMissingAsset()
{
if (mUrl.empty())
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 99053a8ccc..80b0db2e4c 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -490,6 +490,7 @@ public:
BOOL hasFetcher() const { return mHasFetcher;}
void setCanUseHTTP(bool can_use_http) {mCanUseHTTP = can_use_http;}
+ void forceToDeleteRequest();
protected:
/*virtual*/ void switchToCachedImage();
S32 getCurrentDiscardLevelForFetching() ;
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 54ae519422..2008a884db 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -58,6 +58,7 @@
#include "pipeline.h"
#include "llappviewer.h"
#include "llxuiparser.h"
+#include "llagent.h"
////////////////////////////////////////////////////////////////////////////
@@ -597,6 +598,12 @@ static LLFastTimer::DeclareTimer FTM_IMAGE_STATS("Stats");
void LLViewerTextureList::updateImages(F32 max_time)
{
+ if(gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
+ {
+ clearFetchingRequests();
+ return;
+ }
+
LLAppViewer::getTextureFetch()->setTextureBandwidth(LLViewerStats::getInstance()->mTextureKBitStat.getMeanPerSec());
LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages);
@@ -659,6 +666,24 @@ void LLViewerTextureList::updateImages(F32 max_time)
}
}
+void LLViewerTextureList::clearFetchingRequests()
+{
+ if (LLAppViewer::getTextureFetch()->getNumRequests() == 0)
+ {
+ return;
+ }
+
+ for (image_priority_list_t::iterator iter = mImageList.begin();
+ iter != mImageList.end(); ++iter)
+ {
+ LLViewerFetchedTexture* image = *iter;
+ if(image->hasFetcher())
+ {
+ image->forceToDeleteRequest() ;
+ }
+ }
+}
+
void LLViewerTextureList::updateImagesDecodePriorities()
{
// Update the decode priority for N images each frame
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index e0a362596d..64e2c1f791 100644
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -164,6 +164,8 @@ private:
// Implemented in header in case someone changes default params above. JC
LLViewerFetchedTexture* getImageFromHost(const LLUUID& image_id, LLHost host)
{ return getImage(image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); }
+
+ void clearFetchingRequests();
public:
typedef std::set<LLPointer<LLViewerFetchedTexture> > image_list_t;