From 13284fa954e4edcca43eaf98f1a5b457264597b8 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Fri, 28 Aug 2015 19:27:09 +0300 Subject: MAINT-4360 (Setting LogTextureDownloadsToSimulator causes a viewer crash) The fix in fllowing: LLTextureFetch has object LLTextureInfo which is has Recorder object. The recorder object activate (Recorder::handleStart()) self AccumulatorBufferGroup (Recorder::mBuffers into the current (LLTrace::get_thread_recorder()) ThreadRecorder object which created (as I understand) one per thread, and time to time send accumulated data to the master ThreadRecorder. The problem is that LLTextureFetch also can uses from the main thread. I decide add parameter to CTOR LLTextureInfo(bool postponeStartRecoreder) - if it false the recorder start immediatly in LLTextureInfo CTOR body, if true we need to start it manually. Also I add another one LLTextureInfo in LLTextureFetch::mTextureInfoMainThread which is intended for accumulate data from the main thread. The postponed Recorder started/stoped from LLTextureFetch::startThread()/endThread(). --HG-- branch : MAINT-4360 --- indra/newview/lltextureinfo.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'indra/newview/lltextureinfo.cpp') diff --git a/indra/newview/lltextureinfo.cpp b/indra/newview/lltextureinfo.cpp index fbe308595c..59d692b287 100755 --- a/indra/newview/lltextureinfo.cpp +++ b/indra/newview/lltextureinfo.cpp @@ -36,14 +36,14 @@ static LLTrace::CountStatHandle sTextureDownloadsCompleted("texture_downloa static LLTrace::CountStatHandle sTextureDataDownloaded("texture_data_downloaded", "amount of texture data downloaded"); static LLTrace::CountStatHandle sTexureDownloadTime("texture_download_time", "amount of time spent fetching textures"); -LLTextureInfo::LLTextureInfo(bool postponeStartRecoreder) : +LLTextureInfo::LLTextureInfo() : mLogTextureDownloadsToViewerLog(false), mLogTextureDownloadsToSimulator(false), mTextureDownloadProtocol("NONE"), mTextureLogThreshold(LLUnits::Kilobytes::fromValue(100)) { - if (!postponeStartRecoreder) - mRecording.start(); + mTextures.clear(); + mRecording.start(); } void LLTextureInfo::setUpLogging(bool writeToViewerLog, bool sendToSim, U32Bytes textureLogThreshold) @@ -78,7 +78,15 @@ U32 LLTextureInfo::getTextureInfoMapSize() bool LLTextureInfo::has(const LLUUID& id) { - return mTextures.end() != mTextures.find(id); + std::map::iterator iterator = mTextures.find(id); + if (iterator == mTextures.end()) + { + return false; + } + else + { + return true; + } } void LLTextureInfo::setRequestStartTime(const LLUUID& id, U64 startTime) @@ -184,13 +192,15 @@ void LLTextureInfo::setRequestCompleteTimeAndLog(const LLUUID& id, U64Microsecon LLSD LLTextureInfo::getAverages() { LLSD averagedTextureData; - S32 averageDownloadRate = 0; + S32 averageDownloadRate; U32Milliseconds download_time = mRecording.getSum(sTexureDownloadTime); - if(download_time != (U32Milliseconds)0) + if(download_time == (U32Milliseconds)0) { - if (0 != download_time.valueInUnits()) { - averageDownloadRate = mRecording.getSum(sTextureDataDownloaded).valueInUnits() / download_time.valueInUnits(); - } + averageDownloadRate = 0; + } + else + { + averageDownloadRate = mRecording.getSum(sTextureDataDownloaded).valueInUnits() / download_time.valueInUnits(); } averagedTextureData["bits_per_second"] = averageDownloadRate; @@ -202,16 +212,6 @@ LLSD LLTextureInfo::getAverages() return averagedTextureData; } -void LLTextureInfo::startRecording() -{ - mRecording.start(); -} - -void LLTextureInfo::stopRecording() -{ - mRecording.stop(); -} - void LLTextureInfo::resetTextureStatistics() { mRecording.restart(); -- cgit v1.3