diff options
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 504 |
1 files changed, 254 insertions, 250 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index ce4aab20c7..f705084bdb 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llappviewer.cpp * @brief The LLAppViewer class definitions * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2012, 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 * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -199,7 +199,7 @@ #include "llfolderview.h" #include "llagentpilot.h" #include "llvovolume.h" -#include "llflexibleobject.h" +#include "llflexibleobject.h" #include "llvosurfacepatch.h" #include "llviewerfloaterreg.h" #include "llcommandlineparser.h" @@ -238,9 +238,9 @@ #include "llviewereventrecorder.h" // *FIX: These extern globals should be cleaned up. -// The globals either represent state/config/resource-storage of either -// this app, or another 'component' of the viewer. App globals should be -// moved into the app class, where as the other globals should be +// The globals either represent state/config/resource-storage of either +// this app, or another 'component' of the viewer. App globals should be +// moved into the app class, where as the other globals should be // moved out of here. // If a global symbol reference seems valid, it will be included // via header files above. @@ -285,9 +285,9 @@ BOOL gShowObjectUpdates = FALSE; BOOL gUseQuickTime = TRUE; eLastExecEvent gLastExecEvent = LAST_EXEC_NORMAL; -S32 gLastExecDuration = -1; // (<0 indicates unknown) +S32 gLastExecDuration = -1; // (<0 indicates unknown) -#if LL_WINDOWS +#if LL_WINDOWS # define LL_PLATFORM_KEY "win" #elif LL_DARWIN # define LL_PLATFORM_KEY "mac" @@ -545,7 +545,7 @@ bool create_text_segment_icon_from_url_match(LLUrlMatch* match,LLTextBase* base) params.bottom_pad = 2; base->appendWidget(params," ",false); - + return true; } @@ -561,7 +561,7 @@ static void settings_to_globals() MENU_BAR_WIDTH = gSavedSettings.getS32("MenuBarWidth"); LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize")); - + LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLCoreProfile"); LLRender::sNsightDebugSupport = gSavedSettings.getBOOL("RenderNsightDebugSupport"); LLVertexBuffer::sUseVAO = gSavedSettings.getBOOL("RenderUseVAO"); @@ -584,7 +584,7 @@ static void settings_to_globals() gAgentPilot.setNumRuns(gSavedSettings.getS32("StatsNumRuns")); gAgentPilot.setQuitAfterRuns(gSavedSettings.getBOOL("StatsQuitAfterRuns")); gAgent.setHideGroupTitle(gSavedSettings.getBOOL("RenderHideGroupTitle")); - + gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc"); gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates"); LLWorldMapView::sMapScale = gSavedSettings.getF32("MapScale"); @@ -615,7 +615,7 @@ public: void run() { llofstream os(mFile.c_str()); - + while (!LLAppViewer::instance()->isQuitting()) { LLTrace::BlockTimer::writeLog(os); @@ -647,16 +647,16 @@ bool LLAppViewer::sendURLToOtherInstance(const std::string& url) // Static members. // The single viewer app. LLAppViewer* LLAppViewer::sInstance = NULL; -LLTextureCache* LLAppViewer::sTextureCache = NULL; -LLImageDecodeThread* LLAppViewer::sImageDecodeThread = NULL; -LLTextureFetch* LLAppViewer::sTextureFetch = NULL; +LLTextureCache* LLAppViewer::sTextureCache = NULL; +LLImageDecodeThread* LLAppViewer::sImageDecodeThread = NULL; +LLTextureFetch* LLAppViewer::sTextureFetch = NULL; std::string getRuntime() { return llformat("%.4f", (F32)LLTimer::getElapsedSeconds().value()); } -LLAppViewer::LLAppViewer() +LLAppViewer::LLAppViewer() : mMarkerFile(), mLogoutMarkerFile(), mReportedCrash(false), @@ -699,12 +699,12 @@ LLAppViewer::LLAppViewer() gLoggedInTime.stop(); initLoggingAndGetLastDuration(); - + processMarkerFiles(); // // OK to write stuff to logs now, we've now crash reported if necessary // - + LLLoginInstance::instance().setPlatformInfo(gPlatform, LLOSInfo::instance().getOSVersionString(), LLOSInfo::instance().getOSStringSimple()); } @@ -713,7 +713,7 @@ LLAppViewer::~LLAppViewer() delete mSettingsLocationList; destroyMainloopTimeout(); - + // If we got to this destructor somehow, the app didn't hang. removeMarkerFiles(); } @@ -740,7 +740,7 @@ void fast_exit(int rc) bool LLAppViewer::init() -{ +{ setupErrorHandling(mSecondInstance); // @@ -762,12 +762,12 @@ bool LLAppViewer::init() gDirUtilp->setSkinFolder("default", "en"); // initLoggingAndGetLastDuration(); - + // // OK to write stuff to logs now, we've now crash reported if necessary // init_default_trans_args(); - + if (!initConfiguration()) return false; @@ -805,11 +805,11 @@ bool LLAppViewer::init() // Initialize the non-LLCurl libcurl library. Should be called // before consumers (LLTextureFetch). mAppCoreHttp.init(); - + LL_INFOS("InitInfo") << "LLCore::Http initialized." << LL_ENDL ; LLMachineID::init(); - + { if (gSavedSettings.getBOOL("QAModeMetrics")) { @@ -884,7 +884,7 @@ bool LLAppViewer::init() LLKeyboard::setStringTranslatorFunc( LLTrans::getKeyboardString ); LLWeb::initClass(); // do this after LLUI - + // Provide the text fields with callbacks for opening Urls LLUrlAction::setOpenURLCallback(boost::bind(&LLWeb::loadURL, _1, LLStringUtil::null, LLStringUtil::null)); LLUrlAction::setOpenURLInternalCallback(boost::bind(&LLWeb::loadURLInternal, _1, LLStringUtil::null, LLStringUtil::null, false)); @@ -900,11 +900,11 @@ bool LLAppViewer::init() LLFloater::initClass(); ///////////////////////////////////////////////// - + LLToolMgr::getInstance(); // Initialize tool manager if not already instantiated - + LLViewerFloaterReg::registerFloaters(); - + ///////////////////////////////////////////////// // // Load settings files @@ -923,7 +923,7 @@ bool LLAppViewer::init() #else mime_types_name = "mime_types.xml"; #endif - LLMIMETypes::parseMIMETypes( mime_types_name ); + LLMIMETypes::parseMIMETypes( mime_types_name ); // Copy settings to globals. *TODO: Remove or move to appropriage class initializers settings_to_globals(); @@ -984,7 +984,7 @@ bool LLAppViewer::init() LLInitClassList::instance().fireCallbacks(); LLFolderViewItem::initClass(); // SJB: Needs to happen after initWindow(), not sure why but related to fonts - + gGLManager.getGLInfo(gDebugInfo); gGLManager.printGLInfoString(); @@ -1007,7 +1007,7 @@ bool LLAppViewer::init() // If we don't have the right GL requirements, exit. if (!gGLManager.mHasRequirements) - { + { // can't use an alert here since we're exiting and // all hell breaks lose. OSMessageBox( @@ -1019,7 +1019,7 @@ bool LLAppViewer::init() // Without SSE2 support we will crash almost immediately, warn here. if (!gSysCPU.hasSSE2()) - { + { // can't use an alert here since we're exiting and // all hell breaks lose. OSMessageBox( @@ -1035,7 +1035,7 @@ bool LLAppViewer::init() bool unsupported = false; LLSD args; std::string minSpecs; - + // get cpu data from xml std::stringstream minCPUString(LLNotifications::instance().getGlobalString("UnsupportedCPUAmount")); S32 minCPU = 0; @@ -1068,11 +1068,11 @@ bool LLAppViewer::init() if (LLFeatureManager::getInstance()->getGPUClass() == GPU_CLASS_UNKNOWN) { LLNotificationsUtil::add("UnknownGPU"); - } - + } + if(unsupported) { - if(!gSavedSettings.controlExists("WarnUnsupportedHardware") + if(!gSavedSettings.controlExists("WarnUnsupportedHardware") || gSavedSettings.getBOOL("WarnUnsupportedHardware")) { args["MINSPECS"] = minSpecs; @@ -1082,17 +1082,21 @@ bool LLAppViewer::init() } } - char* PARENT = getenv("PARENT"); - if (! (PARENT && std::string(PARENT) == "SL_Launcher")) + // MAINT-8305: If we're processing a SLURL, skip the launcher check. + if (gSavedSettings.getString("CmdLineLoginLocation").empty()) { - // Don't directly run this executable. Please run the launcher, which - // will run the viewer itself. - // Naturally we do not consider this bulletproof. The point is to - // gently remind a user who *inadvertently* finds him/herself in this - // situation to do things the Right Way. Anyone who intentionally - // bypasses this mechanism needs no reminder that s/he's shooting - // him/herself in the foot. - LLNotificationsUtil::add("RunLauncher"); + const char* PARENT = getenv("PARENT"); + if (! (PARENT && std::string(PARENT) == "SL_Launcher")) + { + // Don't directly run this executable. Please run the launcher, which + // will run the viewer itself. + // Naturally we do not consider this bulletproof. The point is to + // gently remind a user who *inadvertently* finds him/herself in this + // situation to do things the Right Way. Anyone who intentionally + // bypasses this mechanism needs no reminder that s/he's shooting + // him/herself in the foot. + LLNotificationsUtil::add("RunLauncher"); + } } #if LL_WINDOWS @@ -1178,7 +1182,7 @@ bool LLAppViewer::init() LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match; - //EXT-7013 - On windows for some locale (Japanese) standard + //EXT-7013 - On windows for some locale (Japanese) standard //datetime formatting functions didn't support some parameters such as "weekday". //Names for days and months localized in xml are also useful for Polish locale(STORM-107). std::string language = gSavedSettings.getString("Language"); @@ -1272,8 +1276,8 @@ void LLAppViewer::checkMemory() bool is_low = LLMemory::isMemoryPoolLow() ; - LLPipeline::throttleNewMemoryAllocation(is_low) ; - + LLPipeline::throttleNewMemoryAllocation(is_low) ; + if(is_low) { LLMemory::logMemoryInfo() ; @@ -1415,7 +1419,7 @@ bool LLAppViewer::doFrame() // Update state based on messages, user input, object idle. { pauseMainloopTimeout(); // *TODO: Remove. Messages shouldn't be stalling for 20+ seconds! - + LL_RECORD_BLOCK_TIME(FTM_IDLE); idle(); @@ -1468,7 +1472,7 @@ bool LLAppViewer::doFrame() // Sleep and run background threads { LL_RECORD_BLOCK_TIME(FTM_SLEEP); - + // yield some time to the os based on command line option static LLCachedControl<S32> yield_time(gSavedSettings, "YieldTime", -1); if(yield_time >= 0) @@ -1494,7 +1498,7 @@ bool LLAppViewer::doFrame() LLAppViewer::getImageDecodeThread()->pause(); } } - + if (mRandomizeFramerate) { ms_sleep(rand() % 200); @@ -1508,7 +1512,7 @@ bool LLAppViewer::doFrame() } S32 total_work_pending = 0; - S32 total_io_pending = 0; + S32 total_io_pending = 0; { S32 work_pending = 0; S32 io_pending = 0; @@ -1535,18 +1539,18 @@ bool LLAppViewer::doFrame() } gMeshRepo.update() ; - + if(!total_work_pending) //pause texture fetching threads if nothing to process. { LLAppViewer::getTextureCache()->pause(); LLAppViewer::getImageDecodeThread()->pause(); - LLAppViewer::getTextureFetch()->pause(); + LLAppViewer::getTextureFetch()->pause(); } if(!total_io_pending) //pause file threads if nothing to process. { - LLVFSThread::sLocal->pause(); - LLLFSThread::sLocal->pause(); - } + LLVFSThread::sLocal->pause(); + LLLFSThread::sLocal->pause(); + } //texture fetching debugger if(LLTextureFetchDebugger::isEnabled()) @@ -1555,7 +1559,7 @@ bool LLAppViewer::doFrame() LLFloaterReg::findTypedInstance<LLFloaterTextureFetchDebugger>("tex_fetch_debugger"); if(tex_fetch_debugger_instance) { - tex_fetch_debugger_instance->idle() ; + tex_fetch_debugger_instance->idle() ; } } @@ -1681,7 +1685,7 @@ bool LLAppViewer::cleanup() LL_INFOS() << "Viewer disconnected" << LL_ENDL; - display_cleanup(); + display_cleanup(); release_start_screen(); // just in case @@ -1706,7 +1710,7 @@ bool LLAppViewer::cleanup() } LLKeyframeDataCache::clear(); - + // End TransferManager before deleting systems it depends on (Audio, VFS, AssetStorage) #if 0 // this seems to get us stuck in an infinite loop... gTransferManager.cleanup(); @@ -1785,24 +1789,24 @@ bool LLAppViewer::cleanup() gViewerWindow->shutdownViews(); LL_INFOS() << "Cleaning up Inventory" << LL_ENDL; - + // Cleanup Inventory after the UI since it will delete any remaining observers // (Deleted observers should have already removed themselves) gInventory.cleanupInventory(); LL_INFOS() << "Cleaning up Selections" << LL_ENDL; - + // Clean up selection managers after UI is destroyed, as UI may be observing them. // Clean up before GL is shut down because we might be holding on to objects with texture references LLSelectMgr::cleanupGlobals(); - + LL_INFOS() << "Shutting down OpenGL" << LL_ENDL; // Shut down OpenGL if( gViewerWindow) { gViewerWindow->shutdownGL(); - + // Destroy window, and make sure we're not fullscreen // This may generate window reshape and activation events. // Therefore must do this before destroying the message system. @@ -1812,26 +1816,26 @@ bool LLAppViewer::cleanup() } LL_INFOS() << "Cleaning up Keyboard & Joystick" << LL_ENDL; - + // viewer UI relies on keyboard so keep it aound until viewer UI isa gone delete gKeyboard; gKeyboard = NULL; // Turn off Space Navigator and similar devices LLViewerJoystick::getInstance()->terminate(); - + LL_INFOS() << "Cleaning up Objects" << LL_ENDL; - + LLViewerObject::cleanupVOClasses(); SUBSYSTEM_CLEANUP(LLAvatarAppearance); - + SUBSYSTEM_CLEANUP(LLAvatarAppearance); - + SUBSYSTEM_CLEANUP(LLPostProcess); LLTracker::cleanupInstance(); - + // *FIX: This is handled in LLAppViewerWin32::cleanup(). // I'm keeping the comment to remember its order in cleanup, // in case of unforseen dependency. @@ -1846,8 +1850,8 @@ bool LLAppViewer::cleanup() } LLPrimitive::cleanupVolumeManager(); - LL_INFOS() << "Additional Cleanup..." << LL_ENDL; - + LL_INFOS() << "Additional Cleanup..." << LL_ENDL; + LLViewerParcelMgr::cleanupGlobals(); // *Note: this is where gViewerStats used to be deleted. @@ -1860,7 +1864,7 @@ bool LLAppViewer::cleanup() SUBSYSTEM_CLEANUP(LLWorldMapView); SUBSYSTEM_CLEANUP(LLFolderViewItem); SUBSYSTEM_CLEANUP(LLUI); - + // // Shut down the VFS's AFTER the decode manager cleans up (since it cleans up vfiles). // Also after viewerwindow is deleted, since it may have image pointers (which have vfiles) @@ -1871,18 +1875,18 @@ bool LLAppViewer::cleanup() SUBSYSTEM_CLEANUP(LLVFile); LL_INFOS() << "Saving Data" << LL_ENDL; - + // Store the time of our current logoff gSavedPerAccountSettings.setU32("LastLogoff", time_corrected()); // Must do this after all panels have been deleted because panels that have persistent rects // save their rects on delete. gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); - + LLUIColorTable::instance().saveUserSettings(); // PerAccountSettingsFile should be empty if no user has been logged on. - // *FIX:Mani This should get really saved in a "logoff" mode. + // *FIX:Mani This should get really saved in a "logoff" mode. if (gSavedSettings.getString("PerAccountSettingsFile").empty()) { LL_INFOS() << "Not saving per-account settings; don't know the account name yet." << LL_ENDL; @@ -1923,13 +1927,13 @@ bool LLAppViewer::cleanup() LL_INFOS() << "Purging all cache files on exit" << LL_ENDL; gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*"); } - + writeDebugInfo(); LLLocationHistory::getInstance()->save(); LLAvatarIconIDCache::getInstance()->save(); - + // Stop the plugin read thread if it's running. LLPluginProcessParent::setUseReadThread(false); @@ -1963,9 +1967,9 @@ bool LLAppViewer::cleanup() // shotdown all worker threads before deleting them in case of co-dependencies mAppCoreHttp.requestStop(); sTextureFetch->shutdown(); - sTextureCache->shutdown(); + sTextureCache->shutdown(); sImageDecodeThread->shutdown(); - + sTextureFetch->shutDownTextureCacheThread() ; sTextureFetch->shutDownImageDecodeThread() ; @@ -1990,16 +1994,16 @@ bool LLAppViewer::cleanup() if (LLFastTimerView::sAnalyzePerformance) { LL_INFOS() << "Analyzing performance" << LL_ENDL; - + std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp"; - std::string current_name = LLTrace::BlockTimer::sLogName + ".slp"; + std::string current_name = LLTrace::BlockTimer::sLogName + ".slp"; std::string report_name = LLTrace::BlockTimer::sLogName + "_report.csv"; LLFastTimerView::doAnalysis( gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name), gDirUtilp->getExpandedFilename(LL_PATH_LOGS, current_name), gDirUtilp->getExpandedFilename(LL_PATH_LOGS, report_name)); - } + } SUBSYSTEM_CLEANUP(LLMetricPerformanceTesterBasic) ; @@ -2012,7 +2016,7 @@ bool LLAppViewer::cleanup() SUBSYSTEM_CLEANUP(LLViewerParcelMedia); gTextureList.shutdown(); // shutdown again in case a callback added something LLUIImageList::getInstance()->cleanUp(); - + // This should eventually be done in LLAppViewer SUBSYSTEM_CLEANUP(LLImage); SUBSYSTEM_CLEANUP(LLVFSThread); @@ -2027,21 +2031,21 @@ bool LLAppViewer::cleanup() #endif LL_INFOS() << "Misc Cleanup" << LL_ENDL; - + // For safety, the LLVFS has to be deleted *after* LLVFSThread. This should be cleaned up. // (LLVFS doesn't know about LLVFSThread so can't kill pending requests) -Steve delete gStaticVFS; gStaticVFS = NULL; delete gVFS; gVFS = NULL; - + gSavedSettings.cleanup(); LLUIColorTable::instance().clear(); LLWatchdog::getInstance()->cleanup(); LLViewerAssetStatsFF::cleanup(); - + // If we're exiting to launch an URL, do that here so the screen // is at the right resolution before we launch IE. if (!gLaunchFileOnQuit.empty()) @@ -2078,7 +2082,7 @@ bool LLAppViewer::cleanup() // all cleanup will get subsumed into the generic calls. So the calls you // still see above are calls that MUST happen before the generic cleanup // kicks in. - + // This calls every remaining LLSingleton's cleanupSingleton() method. // This method should perform any cleanup that might take significant // realtime, or might throw an exception. @@ -2133,7 +2137,7 @@ bool LLAppViewer::initThreads() LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), sImageDecodeThread, enable_threads && true, - app_metrics_qa_mode); + app_metrics_qa_mode); if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog) { @@ -2159,7 +2163,7 @@ void errorCallback(const std::string &error_string) //Set the ErrorActivated global so we know to create a marker file gLLErrorActivated = true; - + LLError::crashAndLoop(error_string); } @@ -2215,7 +2219,7 @@ void LLAppViewer::initLoggingAndGetLastDuration() gLastExecDuration = -1; // unknown } std::string duration_log_msg(duration_log_stream.str()); - + // Create a new start marker file for comparison with log file time for the next run LLAPRFile start_marker_file ; start_marker_file.open(start_marker_file_name, LL_APR_WB); @@ -2238,7 +2242,7 @@ void LLAppViewer::initLoggingAndGetLastDuration() bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, bool set_defaults) -{ +{ if (!mSettingsLocationList) { LL_ERRS() << "Invalid settings location list" << LL_ENDL; @@ -2270,7 +2274,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, std::string full_settings_path; - if (file.file_name_setting.isProvided() + if (file.file_name_setting.isProvided() && gSavedSettings.controlExists(file.file_name_setting)) { // try to find filename stored in file_name_setting control @@ -2357,7 +2361,7 @@ namespace } // anonymous namespace bool LLAppViewer::initConfiguration() -{ +{ //Load settings files list std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml"); LLXMLNodePtr root; @@ -2376,17 +2380,17 @@ bool LLAppViewer::initConfiguration() { LL_ERRS() << "Invalid settings file list " << settings_file_list << LL_ENDL; } - + // The settings and command line parsing have a fragile // order-of-operation: // - load defaults from app_settings // - set procedural settings values // - read command line settings // - selectively apply settings needed to load user settings. - // - load overrides from user_settings + // - load overrides from user_settings // - apply command line settings (to override the overrides) // - load per account settings (happens in llstartup - + // - load defaults bool set_defaults = true; if(!loadSettingsFromDirectory("Default", set_defaults)) @@ -2400,7 +2404,7 @@ bool LLAppViewer::initConfiguration() initStrings(); // setup paths for LLTrans based on settings files only // - set procedural settings // Note: can't use LL_PATH_PER_SL_ACCOUNT for any of these since we haven't logged in yet - gSavedSettings.setString("ClientSettingsFile", + gSavedSettings.setString("ClientSettingsFile", gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Global"))); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -2420,7 +2424,7 @@ bool LLAppViewer::initConfiguration() gSavedSettings.setBOOL("QAMode", TRUE ); gSavedSettings.setS32("WatchdogEnabled", 0); #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 @@ -2442,7 +2446,7 @@ bool LLAppViewer::initConfiguration() // LLFirstUse::addConfigVariable("FirstSculptedPrim"); // LLFirstUse::addConfigVariable("FirstVoice"); // LLFirstUse::addConfigVariable("FirstMedia"); - + // - read command line settings. LLControlGroupCLP clp; std::string cmd_line_config = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, @@ -2455,27 +2459,27 @@ bool LLAppViewer::initConfiguration() handleCommandLineError(clp); return false; } - - // - selectively apply settings + + // - selectively apply settings // If the user has specified a alternate settings file name. // Load it now before loading the user_settings/settings.xml if(clp.hasOption("settings")) { - std::string user_settings_filename = - gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, - clp.getOption("settings")[0]); + std::string user_settings_filename = + gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, + clp.getOption("settings")[0]); gSavedSettings.setString("ClientSettingsFile", user_settings_filename); - LL_INFOS("Settings") << "Using command line specified settings filename: " + LL_INFOS("Settings") << "Using command line specified settings filename: " << user_settings_filename << LL_ENDL; } - // - load overrides from user_settings + // - load overrides from user_settings loadSettingsFromDirectory("User"); if (gSavedSettings.getBOOL("FirstRunThisInstall")) { - // Set firstrun flag to indicate that some further init actiona should be taken + // Set firstrun flag to indicate that some further init actiona should be taken // like determining screen DPI value and so on mIsFirstRun = true; @@ -2484,24 +2488,24 @@ bool LLAppViewer::initConfiguration() if (clp.hasOption("sessionsettings")) { - std::string session_settings_filename = clp.getOption("sessionsettings")[0]; + std::string session_settings_filename = clp.getOption("sessionsettings")[0]; gSavedSettings.setString("SessionSettingsFile", session_settings_filename); - LL_INFOS("Settings") << "Using session settings filename: " + LL_INFOS("Settings") << "Using session settings filename: " << session_settings_filename << LL_ENDL; } loadSettingsFromDirectory("Session"); if (clp.hasOption("usersessionsettings")) { - std::string user_session_settings_filename = clp.getOption("usersessionsettings")[0]; + std::string user_session_settings_filename = clp.getOption("usersessionsettings")[0]; gSavedSettings.setString("UserSessionSettingsFile", user_session_settings_filename); - LL_INFOS("Settings") << "Using user session settings filename: " + LL_INFOS("Settings") << "Using user session settings filename: " << user_session_settings_filename << LL_ENDL; } loadSettingsFromDirectory("UserSession"); - // - apply command line settings + // - apply command line settings if (! clp.notify()) { handleCommandLineError(clp); @@ -2600,9 +2604,9 @@ bool LLAppViewer::initConfiguration() if (gSavedSettings.getBOOL("LogPerformance")) { LLTrace::BlockTimer::sLog = true; - LLTrace::BlockTimer::sLogName = std::string("performance"); + LLTrace::BlockTimer::sLogName = std::string("performance"); } - + std::string test_name(gSavedSettings.getString("LogMetrics")); if (! test_name.empty()) { @@ -2643,20 +2647,20 @@ bool LLAppViewer::initConfiguration() // Handle slurl use. NOTE: Don't let SL-55321 reappear. - // *FIX: This init code should be made more robust to prevent - // the issue SL-55321 from returning. One thought is to allow - // only select options to be set from command line when a slurl - // is specified. More work on the settings system is needed to + // *FIX: This init code should be made more robust to prevent + // the issue SL-55321 from returning. One thought is to allow + // only select options to be set from command line when a slurl + // is specified. More work on the settings system is needed to // achieve this. For now... - // *NOTE:Mani The command line parser parses tokens and is - // setup to bail after parsing the '--url' option or the + // *NOTE:Mani The command line parser parses tokens and is + // setup to bail after parsing the '--url' option or the // first option specified without a '--option' flag (or - // any other option that uses the 'last_option' setting - + // any other option that uses the 'last_option' setting - // see LLControlGroupCLP::configure()) - // What can happen is that someone can use IE (or potentially - // other browsers) and do the rough equivalent of command + // What can happen is that someone can use IE (or potentially + // other browsers) and do the rough equivalent of command // injection and steal passwords. Phoenix. SL-55321 std::string starting_location; @@ -2680,8 +2684,8 @@ bool LLAppViewer::initConfiguration() { start_slurl = starting_location; LLStartUp::setStartSLURL(start_slurl); - if(start_slurl.getType() == LLSLURL::LOCATION) - { + if(start_slurl.getType() == LLSLURL::LOCATION) + { LLGridManager::getInstance()->setGridChoice(start_slurl.getGrid()); } } @@ -2695,7 +2699,7 @@ bool LLAppViewer::initConfiguration() (gSavedSettings.getBOOL("SLURLPassToOtherInstance"))) { if (sendURLToOtherInstance(start_slurl.getSLURLString())) - { + { // successfully handed off URL to existing instance, exit return false; } @@ -2703,7 +2707,7 @@ bool LLAppViewer::initConfiguration() const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent"); if(skinfolder && LLStringUtil::null != skinfolder->getValue().asString()) - { + { // Examining "Language" may not suffice -- see LLUI::getLanguage() // logic. Unfortunately LLUI::getLanguage() doesn't yet do us much // good because we haven't yet called LLUI::initClass(). @@ -2942,8 +2946,8 @@ bool LLAppViewer::initWindow() LL_INFOS("AppInit") << "watchdog setting is done." << LL_ENDL; LLNotificationsUI::LLNotificationManager::getInstance(); - - + + #ifdef LL_DARWIN //Satisfy both MAINT-3135 (OSX 10.6 and earlier) MAINT-3288 (OSX 10.7 and later) LLOSInfo& os_info = LLOSInfo::instance(); @@ -2953,7 +2957,7 @@ bool LLAppViewer::initWindow() gViewerWindow->getWindow()->setOldResize(true); } #endif - + if (gSavedSettings.getBOOL("WindowMaximized")) { gViewerWindow->getWindow()->maximize(); @@ -2968,7 +2972,7 @@ bool LLAppViewer::initWindow() LLFeatureManager::getInstance()->setGraphicsLevel(*mForceGraphicsLevel, false); gSavedSettings.setU32("RenderQualityPerformance", *mForceGraphicsLevel); } - + // Set this flag in case we crash while initializing GL gSavedSettings.setBOOL("RenderInitError", TRUE); gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); @@ -3026,14 +3030,14 @@ void LLAppViewer::writeDebugInfo(bool isStatic) debug_filename = ( isStatic ? getStaticDebugFile() : getDynamicDebugFile() ); - + LL_INFOS() << "Opening debug file " << *debug_filename << LL_ENDL; llofstream out_file(debug_filename->c_str()); - + isStatic ? LLSDSerialize::toPrettyXML(gDebugInfo, out_file) : LLSDSerialize::toPrettyXML(gDebugInfo["Dynamic"], out_file); - - + + out_file.close(); } @@ -3147,7 +3151,7 @@ LLSD LLAppViewer::getViewerInfo() const version_string << version.serverType << " " << version.serverVersion << std::endl; info["VOICE_VERSION"] = version_string.str(); } - else + else { info["VOICE_VERSION"] = LLTrans::getString("NotConnected"); } @@ -3302,9 +3306,9 @@ void LLAppViewer::cleanupSavedSettings() gSavedSettings.setBOOL("UseEnergy", TRUE); // force toggle to turn off, since sends message to simulator gSavedSettings.setBOOL("DebugWindowProc", gDebugWindowProc); - + gSavedSettings.setBOOL("ShowObjectUpdates", gShowObjectUpdates); - + if (gDebugView) { gSavedSettings.setBOOL("ShowDebugConsole", gDebugView->mDebugConsolep->getVisible()); @@ -3318,7 +3322,7 @@ void LLAppViewer::cleanupSavedSettings() if (!maximized) { LLCoordScreen window_pos; - + if (gViewerWindow->getWindow()->getPosition(&window_pos)) { gSavedSettings.setS32("WindowX", window_pos.mX); @@ -3343,10 +3347,10 @@ void LLAppViewer::removeCacheFiles(const std::string& file_mask) void LLAppViewer::writeSystemInfo() { - + if (! gDebugInfo.has("Dynamic") ) gDebugInfo["Dynamic"] = LLSD::emptyMap(); - + #if LL_WINDOWS gDebugInfo["SLLog"] = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"SecondLife.log"); #else @@ -3369,13 +3373,13 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["CPUInfo"]["CPUAltivec"] = gSysCPU.hasAltivec(); gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE(); gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2(); - + gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB().value()); gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated.valueInUnits<LLUnits::Kilobytes>()); gDebugInfo["OSInfo"] = LLOSInfo::instance().getOSStringSimple(); // The user is not logged on yet, but record the current grid choice login url - // which may have been the intended grid. + // which may have been the intended grid. gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridId(); // *FIX:Mani - move this down in llappviewerwin32 @@ -3392,14 +3396,14 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["CrashNotHandled"] = (LLSD::Boolean)true; // Insert crash host url (url to post crash log to) if configured. This insures - // that the crash report will go to the proper location in the case of a + // that the crash report will go to the proper location in the case of a // prior freeze. std::string crashHostUrl = gSavedSettings.get<std::string>("CrashHostUrl"); if(crashHostUrl != "") { gDebugInfo["CrashHostUrl"] = crashHostUrl; } - + // Dump some debugging info LL_INFOS("SystemInfo") << "Application: " << LLTrans::getString("APP_NAME") << LL_ENDL; LL_INFOS("SystemInfo") << "Version: " << LLVersionInfo::getChannelAndVersion() << LL_ENDL; @@ -3423,16 +3427,16 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["FirstLogin"] = (LLSD::Boolean) gAgent.isFirstLogin(); gDebugInfo["FirstRunThisInstall"] = gSavedSettings.getBOOL("FirstRunThisInstall"); gDebugInfo["StartupState"] = LLStartUp::getStartupStateString(); - + writeDebugInfo(); // Save out debug_info.log early, in case of crash. } #ifdef LL_WINDOWS -//For whatever reason, in Windows when using OOP server for breakpad, the callback to get the -//name of the dump file is not getting triggered by the breakpad library. Unfortunately they +//For whatever reason, in Windows when using OOP server for breakpad, the callback to get the +//name of the dump file is not getting triggered by the breakpad library. Unfortunately they //also didn't see fit to provide a simple query request across the pipe to get this name either. //Since we are putting our output in a runtime generated directory and we know the header data in -//the dump format, we can however use the following hack to identify our file. +//the dump format, we can however use the following hack to identify our file. // TODO make this a member function. void getFileList() { @@ -3496,19 +3500,19 @@ void LLAppViewer::handleViewerCrash() return; } pApp->mReportedCrash = TRUE; - + // Insert crash host url (url to post crash log to) if configured. std::string crashHostUrl = gSavedSettings.get<std::string>("CrashHostUrl"); if(crashHostUrl != "") { gDebugInfo["Dynamic"]["CrashHostUrl"] = crashHostUrl; } - + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if ( parcel && parcel->getMusicURL()[0]) { gDebugInfo["Dynamic"]["ParcelMusicURL"] = parcel->getMusicURL(); - } + } if ( parcel && parcel->getMediaURL()[0]) { gDebugInfo["Dynamic"]["ParcelMediaURL"] = parcel->getMediaURL(); @@ -3530,7 +3534,7 @@ void LLAppViewer::handleViewerCrash() { gDebugInfo["Dynamic"]["CurrentSimHost"] = gAgent.getRegionHost().getHostName(); gDebugInfo["Dynamic"]["CurrentRegion"] = gAgent.getRegion()->getName(); - + const LLVector3& loc = gAgent.getPositionAgent(); gDebugInfo["Dynamic"]["CurrentLocationX"] = loc.mV[0]; gDebugInfo["Dynamic"]["CurrentLocationY"] = loc.mV[1]; @@ -3541,14 +3545,14 @@ void LLAppViewer::handleViewerCrash() { gDebugInfo["Dynamic"]["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState(); } - + // The crash is being handled here so set this value to false. // Otherwise the crash logger will think this crash was a freeze. gDebugInfo["Dynamic"]["CrashNotHandled"] = (LLSD::Boolean)false; - + //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 + //we're already in a crash situation if (gDirUtilp) { std::string crash_marker_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, @@ -3570,11 +3574,11 @@ void LLAppViewer::handleViewerCrash() else { LL_WARNS("MarkerFile") << "No gDirUtilp with which to create error marker file name" << LL_ENDL; - } - + } + #ifdef LL_WINDOWS Sleep(200); -#endif +#endif char *minidump_file = pApp->getMiniDumpFilename(); LL_DEBUGS("CRASHREPORT") << "minidump file name " << minidump_file << LL_ENDL; @@ -3588,10 +3592,10 @@ void LLAppViewer::handleViewerCrash() getFileList(); #else LL_WARNS("CRASHREPORT") << "no minidump file?" << LL_ENDL; -#endif +#endif } gDebugInfo["Dynamic"]["CrashType"]="crash"; - + if (gMessageSystem && gDirUtilp) { std::string filename; @@ -3606,7 +3610,7 @@ void LLAppViewer::handleViewerCrash() else { LL_WARNS("CRASHREPORT") << "problem recording stats" << LL_ENDL; - } + } } if (gMessageSystem) @@ -3622,8 +3626,8 @@ void LLAppViewer::handleViewerCrash() } // static -void LLAppViewer::recordMarkerVersion(LLAPRFile& marker_file) -{ +void LLAppViewer::recordMarkerVersion(LLAPRFile& marker_file) +{ std::string marker_version(LLVersionInfo::getChannelAndVersion()); if ( marker_version.length() > MAX_MARKER_LENGTH ) { @@ -3686,7 +3690,7 @@ void LLAppViewer::processMarkerFiles() // now test to see if this file is locked by a running process (try to open for write) LL_DEBUGS("MarkerFile") << "Checking exec marker file for lock..." << LL_ENDL; mMarkerFile.open(mMarkerFileName, LL_APR_WB); - apr_file_t* fMarker = mMarkerFile.getFileHandle() ; + apr_file_t* fMarker = mMarkerFile.getFileHandle() ; if (!fMarker) { LL_INFOS("MarkerFile") << "Exec marker file open failed - assume it is locked." << LL_ENDL; @@ -3702,7 +3706,7 @@ void LLAppViewer::processMarkerFiles() } else { - // No other instances; we've locked this file now, so record our version; delete on quit. + // No other instances; we've locked this file now, so record our version; delete on quit. recordMarkerVersion(mMarkerFile); LL_DEBUGS("MarkerFile") << "Exec marker file existed but was not locked; rewritten." << LL_ENDL; } @@ -3717,7 +3721,7 @@ void LLAppViewer::processMarkerFiles() // the file existed, is ours, and matched our version, so we can report on what it says LL_INFOS("MarkerFile") << "Exec marker '"<< mMarkerFileName << "' found; last exec FROZE" << LL_ENDL; gLastExecEvent = LAST_EXEC_FROZE; - + } else { @@ -3728,12 +3732,12 @@ void LLAppViewer::processMarkerFiles() { // Create the marker file for this execution & lock it; it will be deleted on a clean exit apr_status_t s; - s = mMarkerFile.open(mMarkerFileName, LL_APR_WB, TRUE); + s = mMarkerFile.open(mMarkerFileName, LL_APR_WB, TRUE); if (s == APR_SUCCESS && mMarkerFile.getFileHandle()) { LL_DEBUGS("MarkerFile") << "Exec marker file '"<< mMarkerFileName << "' created." << LL_ENDL; - if (APR_SUCCESS == apr_file_lock(mMarkerFile.getFileHandle(), APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE)) + if (APR_SUCCESS == apr_file_lock(mMarkerFile.getFileHandle(), APR_FLOCK_NONBLOCK | APR_FLOCK_EXCLUSIVE)) { recordMarkerVersion(mMarkerFile); LL_DEBUGS("MarkerFile") << "Exec marker file locked." << LL_ENDL; @@ -3818,7 +3822,7 @@ void LLAppViewer::processMarkerFiles() void LLAppViewer::removeMarkerFiles() { if (!mSecondInstance) - { + { if (mMarkerFile.getFileHandle()) { mMarkerFile.close() ; @@ -3856,8 +3860,8 @@ void LLAppViewer::removeDumpDir() } void LLAppViewer::forceQuit() -{ - LLApp::setQuitting(); +{ + LLApp::setQuitting(); } //TODO: remove @@ -3871,10 +3875,10 @@ void LLAppViewer::fastQuit(S32 error_code) end_messaging_system(); // figure out the error code S32 final_error_code = error_code ? error_code : (S32)isError(); - // this isn't a crash + // this isn't a crash removeMarkerFiles(); // get outta here - _exit(final_error_code); + _exit(final_error_code); } void LLAppViewer::requestQuit() @@ -3882,7 +3886,7 @@ void LLAppViewer::requestQuit() LL_INFOS() << "requestQuit" << LL_ENDL; LLViewerRegion* region = gAgent.getRegion(); - + if( (LLStartUp::getStartupState() < STATE_STARTED) || !region ) { // If we have a region, make some attempt to send a logout request first. @@ -3891,7 +3895,7 @@ void LLAppViewer::requestQuit() { sendLogoutRequest(); } - + // Quit immediately forceQuit(); return; @@ -3905,13 +3909,13 @@ void LLAppViewer::requestQuit() { gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. } - + // Try to send last batch of avatar rez metrics. if (!gDisconnected && isAgentAvatarValid()) { gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. } - + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); @@ -4070,7 +4074,7 @@ void dumpVFSCaches() gStaticVFS->dumpFiles(); SetCurrentDirectory(w_str); #endif - + LL_INFOS() << "========= Dynamic VFS ====" << LL_ENDL; gVFS->listFiles(); #if LL_WINDOWS @@ -4087,7 +4091,7 @@ void dumpVFSCaches() } //static -U32 LLAppViewer::getTextureCacheVersion() +U32 LLAppViewer::getTextureCacheVersion() { //viewer texture cache version, change if the texture cache format changes. const U32 TEXTURE_CACHE_VERSION = 8; @@ -4096,7 +4100,7 @@ U32 LLAppViewer::getTextureCacheVersion() } //static -U32 LLAppViewer::getObjectCacheVersion() +U32 LLAppViewer::getObjectCacheVersion() { // Viewer object cache version, change if object update // format changes. JC @@ -4113,10 +4117,10 @@ bool LLAppViewer::initCache() LLVOCache::getInstance()->setReadOnly(read_only); bool texture_cache_mismatch = false; - if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion()) + if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion()) { texture_cache_mismatch = true; - if(!read_only) + if(!read_only) { gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getTextureCacheVersion()); } @@ -4134,10 +4138,10 @@ bool LLAppViewer::initCache() // STORM-1141 force purgeAllTextures to get called to prevent a crash here. -brad texture_cache_mismatch = true; } - + // We have moved the location of the cache directory over time. migrateCacheDirectory(); - + // Setup and verify the cache location std::string cache_location = gSavedSettings.getString("CacheLocation"); std::string new_cache_location = gSavedSettings.getString("NewCacheLocation"); @@ -4157,7 +4161,7 @@ bool LLAppViewer::initCache() gSavedSettings.setString("CacheLocation", ""); gSavedSettings.setString("CacheLocationTopFolder", ""); } - + if (mPurgeCache && !read_only) { LLSplashScreen::update(LLTrans::getString("StartupClearingCache")); @@ -4165,9 +4169,9 @@ bool LLAppViewer::initCache() } LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache")); - + // Init the texture cache - // Allocate 80% of the cache size for textures + // Allocate 80% of the cache size for textures const S32 MB = 1024 * 1024; const S64 MIN_CACHE_SIZE = 256 * MB; const S64 MAX_CACHE_SIZE = 9984ll * MB; @@ -4185,7 +4189,7 @@ bool LLAppViewer::initCache() LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion()) ; LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS")); - + // Init the VFS vfs_size = llmin(vfs_size + extra, MAX_VFS_SIZE); vfs_size = (vfs_size / MB) * MB; // make sure it is MB aligned @@ -4197,7 +4201,7 @@ bool LLAppViewer::initCache() gSavedSettings.setU32("VFSOldSize", vfs_size_u32 / MB); } LL_INFOS("AppCache") << "VFS CACHE SIZE: " << vfs_size / (1024*1024) << " MB" << LL_ENDL; - + // This has to happen BEFORE starting the vfs // time_t ltime; srand(time(NULL)); // Flawfinder: ignore @@ -4263,7 +4267,7 @@ bool LLAppViewer::initCache() LL_WARNS("AppCache") << "Removing old vfs data file " << old_vfs_data_file << LL_ENDL; LLFile::remove(old_vfs_data_file); LLFile::remove(old_vfs_index_file); - + // Just in case, nuke any other old cache files in the directory. std::string dir; dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); @@ -4289,7 +4293,7 @@ bool LLAppViewer::initCache() if (resize_vfs) { LL_DEBUGS("AppCache") << "Removing old vfs and re-sizing" << LL_ENDL; - + LLFile::remove(old_vfs_data_file); LLFile::remove(old_vfs_index_file); } @@ -4333,7 +4337,7 @@ bool LLAppViewer::initCache() dumpVFSCaches(); } #endif - + return true; } } @@ -4370,12 +4374,12 @@ std::string LLAppViewer::getSecondLifeTitle() const return LLTrans::getString("APP_NAME"); } -std::string LLAppViewer::getWindowTitle() const +std::string LLAppViewer::getWindowTitle() const { return gWindowTitle; } -// Callback from a dialog indicating user was logged out. +// Callback from a dialog indicating user was logged out. bool finish_disconnect(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -4403,7 +4407,7 @@ void LLAppViewer::forceDisconnect(const std::string& mesg) // do this again. return; } - + // *TODO: Translate the message if possible std::string big_reason = LLAgent::sTeleportErrorMessages[mesg]; if ( big_reason.size() == 0 ) @@ -4449,7 +4453,7 @@ void LLAppViewer::badNetworkHandler() "If the problem continues, see the Tech Support FAQ at: \n" "www.secondlife.com/support"; forceDisconnect(message.str()); - + LLApp::instance()->writeMiniDump(); } @@ -4514,7 +4518,7 @@ void LLAppViewer::saveNameCache() { LLAvatarNameCache::exportFile(name_cache_stream); } - + // real names cache if (gCacheName) { @@ -4532,7 +4536,7 @@ void LLAppViewer::saveNameCache() /*! @brief This class is an LLFrameTimer that can be created with an elapsed time that starts counting up from the given value rather than 0.0. - + Otherwise it behaves the same way as LLFrameTimer. */ class LLFrameStatsTimer : public LLFrameTimer @@ -4569,7 +4573,7 @@ static LLTrace::BlockTimerStatHandle FTM_HUD_EFFECTS("HUD Effects"); void LLAppViewer::idle() { pingMainloopTimeout("Main:Idle"); - + // Update frame timers static LLTimer idle_timer; @@ -4627,7 +4631,7 @@ void LLAppViewer::idle() gGLActive = FALSE; } - + F32 yaw = 0.f; // radians if (!gDisconnected) @@ -4635,8 +4639,8 @@ void LLAppViewer::idle() LL_RECORD_BLOCK_TIME(FTM_NETWORK); // Update spaceserver timeinfo LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + LLUnits::Seconds::fromValue(dt_raw)); - - + + ////////////////////////////////////// // // Update simulator agent state @@ -4715,7 +4719,7 @@ void LLAppViewer::idle() if (!gDisconnected) { LL_RECORD_BLOCK_TIME(FTM_NETWORK); - + //////////////////////////////////////////////// // // Network processing @@ -4725,7 +4729,7 @@ void LLAppViewer::idle() // idleNameCache(); idleNetwork(); - + // Check for away from keyboard, kick idle agents. idle_afk_check(); @@ -4739,7 +4743,7 @@ void LLAppViewer::idle() // Handle the regular UI idle callbacks as well as // hover callbacks // - + #ifdef LL_DARWIN if (!mQuitRequested) //MAINT-4243 #endif @@ -4748,12 +4752,12 @@ void LLAppViewer::idle() // Do event notifications if necessary. Yes, we may want to move this elsewhere. gEventNotifier.update(); - + gIdleCallbacks.callFunctions(); gInventory.idleNotifyObservers(); LLAvatarTracker::instance().idleNotifyObservers(); } - + // Metrics logging (LLViewerAssetStats, etc.) { static LLTimer report_interval; @@ -4799,14 +4803,14 @@ void LLAppViewer::idle() } { - LL_RECORD_BLOCK_TIME(FTM_OBJECTLIST_UPDATE); - + LL_RECORD_BLOCK_TIME(FTM_OBJECTLIST_UPDATE); + if (!(logoutRequestSent() && hasSavedFinalSnapshot())) { gObjectList.update(gAgent); } } - + ////////////////////////////////////// // // Deletes objects... @@ -4824,7 +4828,7 @@ void LLAppViewer::idle() LLDrawable::cleanupDeadDrawables(); } } - + // // After this point, in theory we should never see a dead object // in the various object/drawable lists. @@ -4854,7 +4858,7 @@ void LLAppViewer::idle() LL_RECORD_BLOCK_TIME(FTM_NETWORK); gVLManager.unpackData(); } - + ///////////////////////// // // Update surfaces, and surface textures as well. @@ -4866,25 +4870,25 @@ void LLAppViewer::idle() LL_RECORD_BLOCK_TIME(FTM_REGION_UPDATE); LLWorld::getInstance()->updateRegions(max_region_update_time); } - + ///////////////////////// // // Update weather effects // gSky.propagateHeavenlyBodies(gFrameDTClamped); // moves sun, moon, and planets - // Update wind vector + // Update wind vector LLVector3 wind_position_region; static LLVector3 average_wind; LLViewerRegion *regionp; - regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position + regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position if (regionp) { gWindVec = regionp->mWind.getVelocity(wind_position_region); // Compute average wind and use to drive motion of water - + average_wind = regionp->mWind.getAverage(); gSky.setWind(average_wind); //LLVOWater::setWind(average_wind); @@ -4893,13 +4897,13 @@ void LLAppViewer::idle() { gWindVec.setVec(0.0f, 0.0f, 0.0f); } - + ////////////////////////////////////// // // Sort and cull in the new renderer are moved to pipeline.cpp // Here, particles are updated and drawables are moved. // - + LL_RECORD_BLOCK_TIME(FTM_WORLD_UPDATE); gPipeline.updateMove(); @@ -4910,7 +4914,7 @@ void LLAppViewer::idle() gAgentPilot.moveCamera(); } else if (LLViewerJoystick::getInstance()->getOverrideCamera()) - { + { LLViewerJoystick::getInstance()->moveFlycam(); } else @@ -4925,7 +4929,7 @@ void LLAppViewer::idle() // update media focus LLViewerMediaFocus::getInstance()->update(); - + // Update marketplace LLMarketplaceInventoryImporter::update(); LLMarketplaceInventoryNotifications::update(); @@ -4941,7 +4945,7 @@ void LLAppViewer::idle() { LL_RECORD_BLOCK_TIME(FTM_AUDIO_UPDATE); - + if (gAudiop) { audio_update_volume(false); @@ -4956,8 +4960,8 @@ void LLAppViewer::idle() // Execute deferred tasks. LLDeferredTaskList::instance().run(); - - // Handle shutdown process, for example, + + // Handle shutdown process, for example, // wait for floaters to close, send quit message, // forcibly quit if it has taken too long if (mQuitRequested) @@ -4980,7 +4984,7 @@ void LLAppViewer::idleShutdown() { gIMMgr->disconnectAllSessions(); } - + // Wait for all floaters to get resolved if (gFloaterView && !gFloaterView->allChildrenClosed()) @@ -4990,7 +4994,7 @@ void LLAppViewer::idleShutdown() - + // ProductEngine: Try moving this code to where we shut down sTextureCache in cleanup() // *TODO: ugly static bool saved_teleport_history = false; @@ -5048,7 +5052,7 @@ void LLAppViewer::idleShutdown() } // Make sure that we quit if we haven't received a reply from the server. - if( logoutRequestSent() + if( logoutRequestSent() && gLogoutTimer.getElapsedTimeF32() > gLogoutMaxTime ) { forceQuit(); @@ -5065,7 +5069,7 @@ void LLAppViewer::sendLogoutRequest() if (!mSecondInstance) { mLogoutMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LOGOUT_MARKER_FILE_NAME); - + mLogoutMarkerFile.open(mLogoutMarkerFileName, LL_APR_WB); if (mLogoutMarkerFile.getFileHandle()) { @@ -5075,13 +5079,13 @@ void LLAppViewer::sendLogoutRequest() else { LL_WARNS("MarkerFile") << "Cannot create logout marker file " << mLogoutMarkerFileName << LL_ENDL; - } + } } else { LL_INFOS("MarkerFile") << "Did not logout marker file because this is a second instance" << LL_ENDL; } - + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_LogoutRequest); msg->nextBlockFast(_PREHASH_AgentData); @@ -5092,7 +5096,7 @@ void LLAppViewer::sendLogoutRequest() gLogoutTimer.reset(); gLogoutMaxTime = LOGOUT_REQUEST_TIME; mLogoutRequestSent = TRUE; - + if(LLVoiceClient::instanceExists()) { LLVoiceClient::getInstance()->leaveChannel(); @@ -5175,20 +5179,20 @@ static LLTrace::BlockTimerStatHandle FTM_CHECK_REGION_CIRCUIT("Check Region Circ void LLAppViewer::idleNetwork() { pingMainloopTimeout("idleNetwork"); - + gObjectList.mNumNewObjects = 0; S32 total_decoded = 0; if (!gSavedSettings.getBOOL("SpeedTest")) { LL_RECORD_BLOCK_TIME(FTM_IDLE_NETWORK); // decode - + LLTimer check_message_timer; - // Read all available packets from network + // Read all available packets from network const S64 frame_count = gFrameCount; // U32->S64 F32 total_time = 0.0f; - while (gMessageSystem->checkAllMessages(frame_count, gServicePump)) + while (gMessageSystem->checkAllMessages(frame_count, gServicePump)) { if (gDoDisconnect) { @@ -5197,7 +5201,7 @@ void LLAppViewer::idleNetwork() // server going down, so this is OK. break; } - + total_decoded++; gPacketsIn++; @@ -5232,12 +5236,12 @@ void LLAppViewer::idleNetwork() CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME; } #endif - + // we want to clear the control after sending out all necessary agent updates gAgent.resetControlFlags(); - + // Decode enqueued messages... S32 remaining_possible_decodes = MESSAGE_MAX_PER_FRAME - total_decoded; @@ -5284,7 +5288,7 @@ void LLAppViewer::disconnectViewer() } // // Cleanup after quitting. - // + // // Save snapshot for next time, if we made it through initialization LL_INFOS() << "Disconnecting viewer!" << LL_ENDL; @@ -5383,7 +5387,7 @@ void LLAppViewer::forceErrorBadMemoryAccess() { LL_WARNS() << "Forcing a deliberate bad memory access" << LL_ENDL; S32* crash = NULL; - *crash = 0xDEADBEEF; + *crash = 0xDEADBEEF; return; } @@ -5396,7 +5400,7 @@ void LLAppViewer::forceErrorInfiniteLoop() } return; } - + void LLAppViewer::forceErrorSoftwareException() { LL_WARNS() << "Forcing a deliberate exception" << LL_ENDL; @@ -5435,7 +5439,7 @@ void LLAppViewer::resumeMainloopTimeout(const std::string& state, F32 secs) { secs = gSavedSettings.getF32("MainloopTimeoutDefault"); } - + mMainloopTimeout->setTimeout(secs); mMainloopTimeout->start(state); } @@ -5455,7 +5459,7 @@ void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) // { // LL_WARNS() << "!!!!!!!!!!!!! Its an error trap!!!!" << state << LL_ENDL; // } - + if(mMainloopTimeout) { if(secs < 0.0f) @@ -5485,12 +5489,12 @@ void LLAppViewer::handleLoginComplete() if ( parcel && parcel->getMusicURL()[0]) { gDebugInfo["ParcelMusicURL"] = parcel->getMusicURL(); - } + } if ( parcel && parcel->getMediaURL()[0]) { gDebugInfo["ParcelMediaURL"] = parcel->getMediaURL(); } - + gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile"); gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName(); |