From eea0e92faa209f23b677fdee964023d0ce6f2fed Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:53 -0500 Subject: Second Life viewer sources 1.20.8 --- linden/indra/llcommon/llversionviewer.h | 2 +- linden/indra/newview/llappviewer.cpp | 98 +++++++++++++++++++++------ linden/indra/newview/llappviewer.h | 10 +-- linden/indra/newview/llfloaterbuycurrency.cpp | 2 +- linden/indra/newview/llfloaterregioninfo.cpp | 2 +- linden/indra/newview/llhoverview.cpp | 4 +- linden/indra/newview/llstartup.cpp | 4 +- linden/indra/newview/lltexturecache.cpp | 9 +++ linden/indra/newview/llviewernetwork.cpp | 17 ++++- linden/indra/newview/llwatchdog.cpp | 17 +++-- linden/indra/newview/llwatchdog.h | 6 +- linden/indra/newview/llworld.cpp | 4 +- 12 files changed, 135 insertions(+), 40 deletions(-) diff --git a/linden/indra/llcommon/llversionviewer.h b/linden/indra/llcommon/llversionviewer.h index db3d42d..95548db 100644 --- a/linden/indra/llcommon/llversionviewer.h +++ b/linden/indra/llcommon/llversionviewer.h @@ -34,7 +34,7 @@ const S32 LL_VERSION_MAJOR = 1; const S32 LL_VERSION_MINOR = 20; -const S32 LL_VERSION_PATCH = 7; +const S32 LL_VERSION_PATCH = 8; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Release"; diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index c6f4cdd..a461dcb 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp @@ -530,7 +530,8 @@ LLAppViewer::LLAppViewer() : mSavedFinalSnapshot(false), mQuitRequested(false), mLogoutRequestSent(false), - mYieldTime(-1) + mYieldTime(-1), + mMainloopTimeout(NULL) { if(NULL != sInstance) { @@ -538,15 +539,16 @@ LLAppViewer::LLAppViewer() : } sInstance = this; - - // Initialize the mainloop timeout. - mMainloopTimeout = new LLWatchdogTimeout(); } LLAppViewer::~LLAppViewer() { - // Initialize the mainloop timeout. - delete mMainloopTimeout; + if(mMainloopTimeout) + { + // delete the mainloop timeout. + delete mMainloopTimeout; + mMainloopTimeout = NULL; + } // If we got to this destructor somehow, the app didn't hang. removeMarkerFile(); @@ -830,10 +832,6 @@ bool LLAppViewer::init() bool LLAppViewer::mainLoop() { - mMainloopTimeout = new LLWatchdogTimeout(); - // *FIX:Mani - Make this a setting, once new settings exist in this branch. - mMainloopTimeout->setTimeout(5); - //------------------------------------------- // Run main loop until time to quit //------------------------------------------- @@ -933,6 +931,8 @@ bool LLAppViewer::mainLoop() } + pauseMainloopTimeout(); + // Sleep and run background threads { LLFastTimer t2(LLFastTimer::FTM_SLEEP); @@ -1015,7 +1015,9 @@ bool LLAppViewer::mainLoop() //LLVFSThread::sLocal->pause(); // Prevent the VFS thread from running while rendering. //LLLFSThread::sLocal->pause(); // Prevent the LFS thread from running while rendering. - mMainloopTimeout->ping(); + resumeMainloopTimeout(); + + pingMainloopTimeout("Mainloop"); } } @@ -1040,7 +1042,11 @@ bool LLAppViewer::mainLoop() delete gServicePump; - mMainloopTimeout->stop(); + if(mMainloopTimeout) + { + delete mMainloopTimeout; + mMainloopTimeout = NULL; + } llinfos << "Exiting main_loop" << llendflush; @@ -1503,6 +1509,13 @@ bool LLAppViewer::initConfiguration() LLWindow::getFontListSans()); #endif + //*FIX:Mani - Set default to disabling watchdog mainloop + // timeout for mac and linux. There is no call stack info + // on these platform to help debug. +#ifndef LL_WINDOWS + gSavedSettings.setBOOL("WatchdogEnabled", FALSE); +#endif + // These are warnings that appear on the first experience of that condition. // They are already set in the settings_default.xml file, but still need to be added to LLFirstUse // for disable/reset ability @@ -2143,6 +2156,12 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["RAMInfo"] = llformat("%u", gSysMemory.getPhysicalMemoryKB()); gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple(); + // *FIX:Mani - move this ddown in llappviewerwin32 +#ifdef LL_WINDOWS + DWORD thread_id = GetCurrentThreadId(); + gDebugInfo["MainloopThreadID"] = (S32)thread_id; +#endif + // Dump some debugging info LL_INFOS("SystemInfo") << gSecondLife << " version " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH @@ -2227,6 +2246,12 @@ void LLAppViewer::handleViewerCrash() gDebugInfo["CurrentRegion"] = gAgent.getRegion()->getName(); } + if(LLAppViewer::instance()->mMainloopTimeout) + { + gDebugInfo["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState(); + } + + //Write out the crash status file //Use marker file style setup, as that's the simplest, especially since //we're already in a crash situation @@ -3397,6 +3422,8 @@ static F32 CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME; void LLAppViewer::idleNetwork() { + pingMainloopTimeout("idleNetwork"); + gObjectList.mNumNewObjects = 0; S32 total_decoded = 0; @@ -3582,18 +3609,49 @@ void LLAppViewer::forceErrorSoftwareException() throw; } -void LLAppViewer::startMainloopTimeout(F32 secs) +void LLAppViewer::initMainloopTimeout(const std::string& state, F32 secs) { - if(secs < 0.0f) + if(!mMainloopTimeout) { - secs = gSavedSettings.getF32("MainloopTimeoutDefault"); + mMainloopTimeout = new LLWatchdogTimeout(); + resumeMainloopTimeout(state, secs); } - - mMainloopTimeout->setTimeout(secs); - mMainloopTimeout->start(); } -void LLAppViewer::stopMainloopTimeout() +void LLAppViewer::resumeMainloopTimeout(const std::string& state, F32 secs) { - mMainloopTimeout->stop(); + if(mMainloopTimeout) + { + if(secs < 0.0f) + { + secs = gSavedSettings.getF32("MainloopTimeoutDefault"); + } + + mMainloopTimeout->setTimeout(secs); + mMainloopTimeout->start(state); + } +} + +void LLAppViewer::pauseMainloopTimeout() +{ + if(mMainloopTimeout) + { + mMainloopTimeout->stop(); + } } + +void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) +{ + if(mMainloopTimeout) + { + if(secs < 0.0f) + { + secs = gSavedSettings.getF32("MainloopTimeoutDefault"); + } + + mMainloopTimeout->setTimeout(secs); + mMainloopTimeout->ping(state); + } +} + + diff --git a/linden/indra/newview/llappviewer.h b/linden/indra/newview/llappviewer.h index 160f2c8..9f9deb6 100644 --- a/linden/indra/newview/llappviewer.h +++ b/linden/indra/newview/llappviewer.h @@ -129,10 +129,12 @@ public: std::string getSettingsFileName(const std::string& file); // For thread debugging. - // llstartup needs to control this. - // llworld, send_agent_pause() also controls this. - void startMainloopTimeout(F32 secs = -1.0f); - void stopMainloopTimeout(); + // llstartup needs to control init. + // llworld, send_agent_pause() also controls pause/resume. + void initMainloopTimeout(const std::string& state, F32 secs = -1.0f); + void pauseMainloopTimeout(); + void resumeMainloopTimeout(const std::string& state = "", F32 secs = -1.0f); + void pingMainloopTimeout(const std::string& state, F32 secs = -1.0f); protected: virtual bool initWindow(); // Initialize the viewer's window. diff --git a/linden/indra/newview/llfloaterbuycurrency.cpp b/linden/indra/newview/llfloaterbuycurrency.cpp index 0381b8f..e957ba9 100644 --- a/linden/indra/newview/llfloaterbuycurrency.cpp +++ b/linden/indra/newview/llfloaterbuycurrency.cpp @@ -375,7 +375,7 @@ void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) { LLStringBase::format_map_t args; args["[NAME]"] = name.c_str(); - args["[PRICE]"] = price; + args["[PRICE]"] = llformat("%d", price); gViewerWindow->alertXml("NotEnoughCurrency", args); return; } diff --git a/linden/indra/newview/llfloaterregioninfo.cpp b/linden/indra/newview/llfloaterregioninfo.cpp index 7b3b8e2..90d8af9 100644 --- a/linden/indra/newview/llfloaterregioninfo.cpp +++ b/linden/indra/newview/llfloaterregioninfo.cpp @@ -1147,7 +1147,7 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes() { LLString::format_map_t args; - args["[TEXTURE_NUM]"] = i+1; + args["[TEXTURE_NUM]"] = llformat("%d",i+1); args["[TEXTURE_SIZE_X]"] = llformat("%d",width); args["[TEXTURE_SIZE_Y]"] = llformat("%d",height); gViewerWindow->alertXml("InvalidTerrainSize", args); diff --git a/linden/indra/newview/llhoverview.cpp b/linden/indra/newview/llhoverview.cpp index 082f413..c19b361 100644 --- a/linden/indra/newview/llhoverview.cpp +++ b/linden/indra/newview/llhoverview.cpp @@ -414,7 +414,7 @@ void LLHoverView::updateText() else if (for_sale) { LLString::format_map_t args; - args["[AMOUNT]"] = nodep->mSaleInfo.getSalePrice(); + args["[AMOUNT]"] = llformat("%d", nodep->mSaleInfo.getSalePrice()); line.append(LLTrans::getString("TooltipForSaleL$", args)); suppressObjectHoverDisplay = FALSE; // Show tip } @@ -589,7 +589,7 @@ void LLHoverView::updateText() if (hover_parcel && hover_parcel->getParcelFlag(PF_FOR_SALE)) { LLString::format_map_t args; - args["[AMOUNT]"] = hover_parcel->getSalePrice(); + args["[AMOUNT]"] = llformat("%d", hover_parcel->getSalePrice()); line = LLTrans::getString("TooltipForSaleL$", args); mText.push_back(line); } diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 52f4d1a..4dca600 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -1224,7 +1224,7 @@ BOOL idle_startup() sAuthUriNum++; std::ostringstream s; LLString::format_map_t args; - args["[NUMBER]"] = sAuthUriNum + 1; + args["[NUMBER]"] = llformat("%d", sAuthUriNum + 1); auth_desc = LLTrans::getString("LoginAttempt", args).c_str(); LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE ); return do_normal_idle; @@ -2329,7 +2329,7 @@ BOOL idle_startup() gDebugView->mFastTimerView->setVisible(TRUE); #endif - LLAppViewer::instance()->startMainloopTimeout(); + LLAppViewer::instance()->initMainloopTimeout("Mainloop Init"); return do_normal_idle; } diff --git a/linden/indra/newview/lltexturecache.cpp b/linden/indra/newview/lltexturecache.cpp index ab85b32..8240f77 100644 --- a/linden/indra/newview/lltexturecache.cpp +++ b/linden/indra/newview/lltexturecache.cpp @@ -39,6 +39,9 @@ #include "lllfsthread.h" #include "llviewercontrol.h" +// Included to allow LLTextureCache::purgeTextures() to pause watchdog timeout +#include "llappviewer.h" + #define USE_LFS_READ 0 #define USE_LFS_WRITE 0 @@ -1155,6 +1158,9 @@ void LLTextureCache::purgeTextures(bool validate) return; } + // *FIX:Mani - watchdog off. + LLAppViewer::instance()->pauseMainloopTimeout(); + LLMutexLock lock(&mHeaderMutex); S32 filesize = ll_apr_file_size(mTexturesDirEntriesFileName, NULL); @@ -1275,6 +1281,9 @@ void LLTextureCache::purgeTextures(bool validate) llassert(mTexturesSizeTotal == total_size); delete[] entries; + + // *FIX:Mani - watchdog back on. + LLAppViewer::instance()->resumeMainloopTimeout(); LL_INFOS("TextureCache") << "TEXTURE CACHE:" << " PURGED: " << purge_count diff --git a/linden/indra/newview/llviewernetwork.cpp b/linden/indra/newview/llviewernetwork.cpp index 3224c00..c1de774 100644 --- a/linden/indra/newview/llviewernetwork.cpp +++ b/linden/indra/newview/llviewernetwork.cpp @@ -277,7 +277,22 @@ void LLViewerLogin::getLoginURIs(std::vector& uris) const std::string LLViewerLogin::getHelperURI() const { - return gSavedSettings.getString("CmdLineHelperURI"); + std::string helper_uri = gSavedSettings.getString("CmdLineHelperURI"); + if (helper_uri.empty()) + { + // grab URI from selected grid + if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER) + { + helper_uri = gGridInfo[mGridChoice].mHelperURI; + } + + if (helper_uri.empty()) + { + // what do we do with unnamed/miscellaneous grids? + // for now, operations that rely on the helper URI (currency/land purchasing) will fail + } + } + return helper_uri; } bool LLViewerLogin::isInProductionGrid() diff --git a/linden/indra/newview/llwatchdog.cpp b/linden/indra/newview/llwatchdog.cpp index 1dd984e..d92d381 100644 --- a/linden/indra/newview/llwatchdog.cpp +++ b/linden/indra/newview/llwatchdog.cpp @@ -74,6 +74,7 @@ LLWatchdogEntry::LLWatchdogEntry() LLWatchdogEntry::~LLWatchdogEntry() { + stop(); } void LLWatchdogEntry::start() @@ -87,8 +88,11 @@ void LLWatchdogEntry::stop() } // LLWatchdogTimeout +const std::string UNINIT_STRING = "uninitialized"; + LLWatchdogTimeout::LLWatchdogTimeout() : - mTimeout(0.0f) + mTimeout(0.0f), + mPingState(UNINIT_STRING) { } @@ -106,23 +110,28 @@ void LLWatchdogTimeout::setTimeout(F32 d) mTimeout = d; } -void LLWatchdogTimeout::start() +void LLWatchdogTimeout::start(const std::string& state) { // Order of operation is very impmortant here. // After LLWatchdogEntry::start() is called // LLWatchdogTimeout::isAlive() will be called asynchronously. mTimer.start(); - mTimer.setTimerExpirySec(mTimeout); + ping(state); LLWatchdogEntry::start(); } + void LLWatchdogTimeout::stop() { LLWatchdogEntry::stop(); mTimer.stop(); } -void LLWatchdogTimeout::ping() +void LLWatchdogTimeout::ping(const std::string& state) { + if(!state.empty()) + { + mPingState = state; + } mTimer.setTimerExpirySec(mTimeout); } diff --git a/linden/indra/newview/llwatchdog.h b/linden/indra/newview/llwatchdog.h index 96388bb..c1f2b94 100644 --- a/linden/indra/newview/llwatchdog.h +++ b/linden/indra/newview/llwatchdog.h @@ -59,15 +59,17 @@ public: virtual ~LLWatchdogTimeout(); /* virtual */ bool isAlive() const; - /* virtual */ void start(); + /* virtual */ void start(const std::string& state); /* virtual */ void stop(); void setTimeout(F32 d); - void ping(); + void ping(const std::string& state); + const std::string& getState() {return mPingState; } private: LLTimer mTimer; F32 mTimeout; + std::string mPingState; }; class LLWatchdogTimerThread; // Defined in the cpp diff --git a/linden/indra/newview/llworld.cpp b/linden/indra/newview/llworld.cpp index 27d7513..2c2440c 100644 --- a/linden/indra/newview/llworld.cpp +++ b/linden/indra/newview/llworld.cpp @@ -1117,7 +1117,7 @@ void send_agent_pause() { // *NOTE:Mani Pausing the mainloop timeout. Otherwise a long modal event may cause // the thread monitor to timeout. - LLAppViewer::instance()->stopMainloopTimeout(); + LLAppViewer::instance()->pauseMainloopTimeout(); // Note: used to check for LLWorld initialization before it became a singleton. // Rather than just remove this check I'm changing it to assure that the message @@ -1175,7 +1175,7 @@ void send_agent_resume() // Reset the FPS counter to avoid an invalid fps LLViewerStats::getInstance()->mFPSStat.start(); - LLAppViewer::instance()->startMainloopTimeout(); + LLAppViewer::instance()->resumeMainloopTimeout(); } -- cgit v1.1