summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturefetch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltexturefetch.cpp')
-rwxr-xr-xindra/newview/lltexturefetch.cpp113
1 files changed, 59 insertions, 54 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 40f8c344e5..2acd38b753 100755
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -4,7 +4,7 @@
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
- * Copyright (C) 2012, Linden Research, Inc.
+ * Copyright (C) 2012-2013, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -64,7 +64,7 @@
#include "bufferarray.h"
#include "bufferstream.h"
-bool LLTextureFetchDebugger::sDebuggerEnabled = false;
+bool LLTextureFetchDebugger::sDebuggerEnabled = false ;
LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > LLTextureFetch::sCacheHitRate("texture_cache_hits");
LLTrace::EventStatHandle<F64Milliseconds > LLTextureFetch::sCacheReadLatency("texture_cache_read_latency");
@@ -505,19 +505,19 @@ private:
e_state mState;
void setState(e_state new_state);
- e_write_to_cache_state mWriteToCacheState;
- LLTextureFetch* mFetcher;
+ e_write_to_cache_state mWriteToCacheState;
+ LLTextureFetch* mFetcher;
LLPointer<LLImageFormatted> mFormattedImage;
LLPointer<LLImageRaw> mRawImage,
mAuxImage;
- FTType mFTType;
- LLUUID mID;
- LLHost mHost;
- std::string mUrl;
- U8 mType;
- F32 mImagePriority;
- U32 mWorkPriority;
- F32 mRequestedPriority;
+ FTType mFTType;
+ LLUUID mID;
+ LLHost mHost;
+ std::string mUrl;
+ U8 mType;
+ F32 mImagePriority;
+ U32 mWorkPriority;
+ F32 mRequestedPriority;
S32 mDesiredDiscard,
mSimRequestedDiscard,
mRequestedDiscard,
@@ -525,8 +525,8 @@ private:
mDecodedDiscard;
LLFrameTimer mRequestedTimer,
mFetchTimer;
- LLTimer mCacheReadTimer;
- F32 mCacheReadTime;
+ LLTimer mCacheReadTimer;
+ F32 mCacheReadTime;
LLTextureCache::handle_t mCacheReadHandle,
mCacheWriteHandle;
S32 mRequestedSize,
@@ -534,24 +534,24 @@ private:
mDesiredSize,
mFileSize,
mCachedSize;
- e_request_state mSentRequest;
- handle_t mDecodeHandle;
- BOOL mLoaded;
- BOOL mDecoded;
- BOOL mWritten;
- BOOL mNeedsAux;
- BOOL mHaveAllData;
- BOOL mInLocalCache;
- BOOL mInCache;
+ e_request_state mSentRequest;
+ handle_t mDecodeHandle;
+ BOOL mLoaded;
+ BOOL mDecoded;
+ BOOL mWritten;
+ BOOL mNeedsAux;
+ BOOL mHaveAllData;
+ BOOL mInLocalCache;
+ BOOL mInCache;
bool mCanUseHTTP,
mCanUseNET ; //can get from asset server.
- S32 mRetryAttempt;
- S32 mActiveCount;
- LLCore::HttpStatus mGetStatus;
- std::string mGetReason;
+ S32 mRetryAttempt;
+ S32 mActiveCount;
+ LLCore::HttpStatus mGetStatus;
+ std::string mGetReason;
// Work Data
- LLMutex mWorkMutex;
+ LLMutex mWorkMutex;
struct PacketData
{
PacketData(U8* data, S32 size)
@@ -560,24 +560,24 @@ private:
~PacketData() { clearData(); }
void clearData() { delete[] mData; mData = NULL; }
- U8* mData;
- U32 mSize;
+ U8* mData;
+ U32 mSize;
};
- std::vector<PacketData*> mPackets;
- S32 mFirstPacket;
- S32 mLastPacket;
- U16 mTotalPackets;
- U8 mImageCodec;
+ std::vector<PacketData*> mPackets;
+ S32 mFirstPacket;
+ S32 mLastPacket;
+ U16 mTotalPackets;
+ U8 mImageCodec;
LLViewerAssetStats::duration_t mMetricsStartTime;
- LLCore::HttpHandle mHttpHandle; // Handle of any active request
- LLCore::BufferArray * mHttpBufferArray; // Refcounted pointer to response data
+ LLCore::HttpHandle mHttpHandle; // Handle of any active request
+ LLCore::BufferArray * mHttpBufferArray; // Refcounted pointer to response data
S32 mHttpPolicyClass;
- bool mHttpActive; // Active request to http library
+ bool mHttpActive; // Active request to http library
U32 mHttpReplySize, // Actual received data size
mHttpReplyOffset; // Actual received data offset
- bool mHttpHasResource; // Counts against Fetcher's mHttpSemaphore
+ bool mHttpHasResource; // Counts against Fetcher's mHttpSemaphore
// State history
U32 mCacheReadCount,
@@ -1557,7 +1557,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
else
{
LL_INFOS() << "HTTP GET failed for: " << mUrl
- << " Status: " << mGetStatus.toHex()
+ << " Status: " << mGetStatus.toTerseString()
<< " Reason: '" << mGetReason << "'"
<< LL_ENDL;
}
@@ -1900,8 +1900,8 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe
LLCore::HttpStatus status(response->getStatus());
LL_DEBUGS("Texture") << "HTTP COMPLETE: " << mID
- << " status: " << status.toHex()
- << " '" << status.toString() << "'"
+ << " status: " << status.toTerseString()
+ << " '" << status.toString() << "'"
<< LL_ENDL;
// unsigned int offset(0), length(0), full_length(0);
// response->getRange(&offset, &length, &full_length);
@@ -1916,7 +1916,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe
success = false;
std::string reason(status.toString());
setGetStatus(status, reason);
- LL_WARNS() << "CURL GET FAILED, status: " << status.toHex()
+ LL_WARNS() << "CURL GET FAILED, status: " << status.toTerseString()
<< " reason: " << reason << LL_ENDL;
}
else
@@ -2380,6 +2380,7 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
mQAMode(qa_mode),
mHttpRequest(NULL),
mHttpOptions(NULL),
+ mHttpOptionsWithHeaders(NULL),
mHttpHeaders(NULL),
mHttpMetricsHeaders(NULL),
mHttpPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID),
@@ -2410,15 +2411,13 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
mHttpRequest = new LLCore::HttpRequest;
mHttpOptions = new LLCore::HttpOptions;
+ mHttpOptionsWithHeaders = new LLCore::HttpOptions;
+ mHttpOptionsWithHeaders->setWantHeaders(true);
mHttpHeaders = new LLCore::HttpHeaders;
- mHttpHeaders->mHeaders.push_back("Accept: image/x-j2c");
+ mHttpHeaders->append("Accept", "image/x-j2c");
mHttpMetricsHeaders = new LLCore::HttpHeaders;
- mHttpMetricsHeaders->mHeaders.push_back("Content-Type: application/llsd+xml");
- mHttpPolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicyDefault();
-
- //reset the texture timer.
- gTextureTimer.reset();
- gTextureTimer.pause();
+ mHttpMetricsHeaders->append("Content-Type", "application/llsd+xml");
+ mHttpPolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicy(LLAppCoreHttp::AP_TEXTURE);
}
LLTextureFetch::~LLTextureFetch()
@@ -2438,6 +2437,12 @@ LLTextureFetch::~LLTextureFetch()
mHttpOptions = NULL;
}
+ if (mHttpOptionsWithHeaders)
+ {
+ mHttpOptionsWithHeaders->release();
+ mHttpOptionsWithHeaders = NULL;
+ }
+
if (mHttpHeaders)
{
mHttpHeaders->release();
@@ -3780,7 +3785,7 @@ public:
else
{
LL_WARNS("Texture") << "Error delivering asset metrics to grid. Status: "
- << status.toHex()
+ << status.toTerseString()
<< ", Reason: " << status.toString() << LL_ENDL;
}
}
@@ -4052,7 +4057,7 @@ void LLTextureFetchDebugger::init()
if (! mHttpHeaders)
{
mHttpHeaders = new LLCore::HttpHeaders;
- mHttpHeaders->mHeaders.push_back("Accept: image/x-j2c");
+ mHttpHeaders->append("Accept", "image/x-j2c");
}
}
@@ -4472,7 +4477,7 @@ S32 LLTextureFetchDebugger::fillCurlQueue()
LL_WARNS("Texture") << "Couldn't issue HTTP request in debugger for texture "
<< mFetchingHistory[i].mID
- << ", status: " << status.toHex()
+ << ", status: " << status.toTerseString()
<< " reason: " << status.toString()
<< LL_ENDL;
mFetchingHistory[i].mCurlState = FetchEntry::CURL_DONE;
@@ -4865,7 +4870,7 @@ void LLTextureFetchDebugger::callbackHTTP(FetchEntry & fetch, LLCore::HttpRespon
else //failed
{
LL_INFOS() << "Fetch Debugger : CURL GET FAILED, ID = " << fetch.mID
- << ", status: " << status.toHex()
+ << ", status: " << status.toTerseString()
<< " reason: " << status.toString() << LL_ENDL;
}
}