From 8fa09570ec91a656e55f88de882fc81fe39f35fa Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sat, 9 Sep 2023 22:19:22 -0700 Subject: Updates to build on mac. --- indra/newview/llappviewer.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llappviewer.h') diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 6d1496d517..bfa1dea324 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -43,6 +43,7 @@ #ifndef LL_LLAPPVIEWER_H #define LL_LLAPPVIEWER_H +#include "llapp.h" #include "llallocator.h" #include "llapr.h" #include "llcontrol.h" -- cgit v1.2.3 From 60d3dd98a44230c21803c1606552ee098ed9fa7c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 21 Feb 2024 21:05:14 +0100 Subject: Convert remaining BOOL to bool --- indra/newview/llappviewer.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview/llappviewer.h') diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 6d1496d517..fe21c0a1be 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -341,7 +341,7 @@ const S32 AGENT_FORCE_UPDATES_PER_SECOND = 1; // "// llstartup" indicates that llstartup is the only client for this global. extern LLSD gDebugInfo; -extern BOOL gShowObjectUpdates; +extern bool gShowObjectUpdates; typedef enum { @@ -382,10 +382,10 @@ extern S32 gPendingMetricsUploads; extern F32 gSimLastTime; extern F32 gSimFrames; -extern BOOL gDisconnected; +extern bool gDisconnected; extern LLFrameTimer gRestoreGLTimer; -extern BOOL gRestoreGL; +extern bool gRestoreGL; extern bool gUseWireframe; extern LLMemoryInfo gSysMemory; @@ -396,13 +396,13 @@ extern std::string gLastVersionChannel; extern LLVector3 gWindVec; extern LLVector3 gRelativeWindVec; extern U32 gPacketsIn; -extern BOOL gPrintMessagesThisFrame; +extern bool gPrintMessagesThisFrame; extern LLUUID gBlackSquareID; -extern BOOL gRandomizeFramerate; -extern BOOL gPeriodicSlowFrame; +extern bool gRandomizeFramerate; +extern bool gPeriodicSlowFrame; -extern BOOL gSimulateMemLeak; +extern bool gSimulateMemLeak; #endif // LL_LLAPPVIEWER_H -- cgit v1.2.3 From 7fc5f7e649c564fa8479a72a45459d0cc427d0f8 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Thu, 2 May 2024 10:57:39 -0500 Subject: #1354 Make coroutines use LLCoros::Mutex instead of LLMutex (#1356) * #1354 Make coroutines use LLCoros::Mutex instead of LLMutex * #1354 Fix some more unsafe coroutine executions. * #1354 Implement changes requested by Nat --- indra/newview/llappviewer.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llappviewer.h') diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 9352dba06d..92976a70af 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -226,6 +226,9 @@ public: void updateNameLookupUrl(const LLViewerRegion* regionp); + // post given work to the "mainloop" work queue for handling on the main thread + void postToMainCoro(const LL::WorkQueue::Work& work); + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual void initLoggingAndGetLastDuration(); // Initialize log files, logging system -- cgit v1.2.3 From e2e37cced861b98de8c1a7c9c0d3a50d2d90e433 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 May 2024 21:25:21 +0200 Subject: Fix line endlings --- indra/newview/llappviewer.h | 820 ++++++++++++++++++++++---------------------- 1 file changed, 410 insertions(+), 410 deletions(-) (limited to 'indra/newview/llappviewer.h') diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index fc13fd9093..4245e3da97 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -1,410 +1,410 @@ -/** - * @mainpage - * @mainpage - * - * This is the sources for the Second Life Viewer; - * information on the open source project is at - * https://wiki.secondlife.com/wiki/Open_Source_Portal - * - * The Mercurial repository for the trunk version is at - * https://bitbucket.org/lindenlab/viewer-release - * - * @section source-license Source License - * @verbinclude LICENSE-source.txt - * - * @section artwork-license Artwork License - * @verbinclude LICENSE-logos.txt - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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$ - * - * @file llappviewer.h - * @brief The LLAppViewer class declaration - */ - -#ifndef LL_LLAPPVIEWER_H -#define LL_LLAPPVIEWER_H - -#include "llallocator.h" -#include "llapr.h" -#include "llcontrol.h" -#include "llsys.h" // for LLOSInfo -#include "lltimer.h" -#include "llappcorehttp.h" -#include "threadpool_fwd.h" - -#include - -class LLCommandLineParser; -class LLFrameTimer; -class LLPumpIO; -class LLTextureCache; -class LLImageDecodeThread; -class LLTextureFetch; -class LLWatchdogTimeout; -class LLViewerJoystick; -class LLPurgeDiskCacheThread; -class LLViewerRegion; - -extern LLTrace::BlockTimerStatHandle FTM_FRAME; - -class LLAppViewer : public LLApp -{ -public: - LLAppViewer(); - virtual ~LLAppViewer(); - - /** - * @brief Access to the LLAppViewer singleton. - * - * The LLAppViewer singleton is created in main()/WinMain(). - * So don't use it in pre-entry (static initialization) code. - */ - static LLAppViewer* instance() {return sInstance; } - - // - // Main application logic - // - virtual bool init(); // Override to do application initialization - virtual bool cleanup(); // Override to do application cleanup - virtual bool frame(); // Override for application body logic - - // Application control - void flushLFSIO(); // waits for lfs transfers to complete - void forceQuit(); // Puts the viewer into 'shutting down without error' mode. - void fastQuit(S32 error_code = 0); // Shuts down the viewer immediately after sending a logout message - void requestQuit(); // Request a quit. A kinder, gentler quit. - void userQuit(); // The users asks to quit. Confirm, then requestQuit() - void earlyExit(const std::string& name, - const LLSD& substitutions = LLSD()); // Display an error dialog and forcibly quit. - void earlyExitNoNotify(); // Do not display error dialog then forcibly quit. - void abortQuit(); // Called to abort a quit request. - - bool quitRequested() { return mQuitRequested; } - bool logoutRequestSent() { return mLogoutRequestSent; } - bool isSecondInstance() { return mSecondInstance; } - bool isUpdaterMissing(); // In use by tests - bool waitForUpdater(); - - void writeDebugInfo(bool isStatic=true); - - void setServerReleaseNotesURL(const std::string& url) { mServerReleaseNotesURL = url; } - LLSD getViewerInfo() const; - std::string getViewerInfoString(bool default_string = false) const; - - // Report true if under the control of a debugger. A null-op default. - virtual bool beingDebugged() { return false; } - - virtual bool restoreErrorTrap() = 0; // Require platform specific override to reset error handling mechanism. - // return false if the error trap needed restoration. - void checkForCrash(); - - // Thread accessors - static LLTextureCache* getTextureCache() { return sTextureCache; } - static LLImageDecodeThread* getImageDecodeThread() { return sImageDecodeThread; } - static LLTextureFetch* getTextureFetch() { return sTextureFetch; } - static LLPurgeDiskCacheThread* getPurgeDiskCacheThread() { return sPurgeDiskCacheThread; } - - static U32 getTextureCacheVersion() ; - static U32 getObjectCacheVersion() ; - static U32 getDiskCacheVersion() ; - - const std::string& getSerialNumber() { return mSerialNumber; } - - bool getPurgeCache() const { return mPurgeCache; } - - std::string getSecondLifeTitle() const; // The Second Life title. - std::string getWindowTitle() const; // The window display name. - - void forceDisconnect(const std::string& msg); // Force disconnection, with a message to the user. - void badNetworkHandler(); // Cause a crash state due to bad network packet. - - bool hasSavedFinalSnapshot() { return mSavedFinalSnapshot; } - void saveFinalSnapshot(); - - void loadNameCache(); - void saveNameCache(); - - void loadExperienceCache(); - void saveExperienceCache(); - - void removeMarkerFiles(); - - void removeDumpDir(); - // LLAppViewer testing helpers. - // *NOTE: These will potentially crash the viewer. Only for debugging. - virtual void forceErrorLLError(); - virtual void forceErrorLLErrorMsg(); - virtual void forceErrorBreakpoint(); - virtual void forceErrorBadMemoryAccess(); - virtual void forceErrorInfiniteLoop(); - virtual void forceErrorSoftwareException(); - virtual void forceErrorOSSpecificException(); - virtual void forceErrorDriverCrash(); - virtual void forceErrorCoroutineCrash(); - virtual void forceErrorThreadCrash(); - - // The list is found in app_settings/settings_files.xml - // but since they are used explicitly in code, - // the follow consts should also do the trick. - static const std::string sGlobalSettingsName; - - LLCachedControl mRandomizeFramerate; - LLCachedControl mPeriodicSlowFrame; - - // Load settings from the location specified by loction_key. - // Key availale and rules for loading, are specified in - // 'app_settings/settings_files.xml' - bool loadSettingsFromDirectory(const std::string& location_key, - bool set_defaults = false); - - std::string getSettingsFilename(const std::string& location_key, - const std::string& file); - void loadColorSettings(); - - // For thread debugging. - // llstartup needs to control init. - // llworld, send_agent_pause() also controls pause/resume. - void initMainloopTimeout(const std::string& state, F32 secs = -1.0f); - void destroyMainloopTimeout(); - void pauseMainloopTimeout(); - void resumeMainloopTimeout(const std::string& state = "", F32 secs = -1.0f); - void pingMainloopTimeout(const std::string& state, F32 secs = -1.0f); - - // Handle the 'login completed' event. - // *NOTE:Mani Fix this for login abstraction!! - void handleLoginComplete(); - - LLAllocator & getAllocator() { return mAlloc; } - - // On LoginCompleted callback - typedef boost::signals2::signal login_completed_signal_t; - login_completed_signal_t mOnLoginCompleted; - boost::signals2::connection setOnLoginCompletedCallback( const login_completed_signal_t::slot_type& cb ) - { - return mOnLoginCompleted.connect(cb); - } - - void addOnIdleCallback(const boost::function& cb); // add a callback to fire (once) when idle - - void initGeneralThread(); - void purgeUserDataOnExit() { mPurgeUserDataOnExit = true; } - void purgeCache(); // Clear the local cache. - void purgeCacheImmediate(); //clear local cache immediately. - S32 updateTextureThreads(F32 max_time); - - void loadKeyBindings(); - - // mute/unmute the system's master audio - virtual void setMasterSystemAudioMute(bool mute); - virtual bool getMasterSystemAudioMute(); - - // Metrics policy helper statics. - static void metricsUpdateRegion(U64 region_handle); - static void metricsSend(bool enable_reporting); - - // llcorehttp init/shutdown/config information. - LLAppCoreHttp & getAppCoreHttp() { return mAppCoreHttp; } - - void updateNameLookupUrl(const LLViewerRegion* regionp); - -protected: - virtual bool initWindow(); // Initialize the viewer's window. - virtual void initLoggingAndGetLastDuration(); // Initialize log files, logging system - virtual void initConsole() {}; // Initialize OS level debugging console. - virtual bool initHardwareTest() { return true; } // A false result indicates the app should quit. - virtual bool initSLURLHandler(); - virtual bool sendURLToOtherInstance(const std::string& url); - - virtual bool initParseCommandLine(LLCommandLineParser& clp) - { return true; } // Allow platforms to specify the command line args. - - virtual std::string generateSerialNumber() = 0; // Platforms specific classes generate this. - - virtual bool meetsRequirementsForMaximizedStart(); // Used on first login to decide to launch maximized - -private: - - bool doFrame(); - - void initMaxHeapSize(); - bool initThreads(); // Initialize viewer threads, return false on failure. - bool initConfiguration(); // Initialize settings from the command line/config file. - void initStrings(); // Initialize LLTrans machinery - bool initCache(); // Initialize local client cache. - - // We have switched locations of both Mac and Windows cache, make sure - // files migrate and old cache is cleared out. - void migrateCacheDirectory(); - - void cleanupSavedSettings(); // Sets some config data to current or default values during cleanup. - void removeCacheFiles(const std::string& filemask); // Deletes cached files the match the given wildcard. - - void writeSystemInfo(); // Write system info to "debug_info.log" - - void processMarkerFiles(); - static void recordMarkerVersion(LLAPRFile& marker_file); - bool markerIsSameVersion(const std::string& marker_name) const; - - void idle(); - void idleShutdown(); - // update avatar SLID and display name caches - void idleNameCache(); - void idleNetwork(); - - void sendLogoutRequest(); - void disconnectViewer(); - - // *FIX: the app viewer class should be some sort of singleton, no? - // Perhaps its child class is the singleton and this should be an abstract base. - static LLAppViewer* sInstance; - - bool mSecondInstance; // Is this a second instance of the app? - bool mUpdaterNotFound; // True when attempt to start updater failed - - std::string mMarkerFileName; - LLAPRFile mMarkerFile; // A file created to indicate the app is running. - - std::string mLogoutMarkerFileName; - LLAPRFile mLogoutMarkerFile; // A file created to indicate the app is running. - - bool mReportedCrash; - - std::string mServerReleaseNotesURL; - - // Thread objects. - static LLTextureCache* sTextureCache; - static LLImageDecodeThread* sImageDecodeThread; - static LLTextureFetch* sTextureFetch; - static LLPurgeDiskCacheThread* sPurgeDiskCacheThread; - LL::ThreadPool* mGeneralThreadPool; - - S32 mNumSessions; - - std::string mSerialNumber; - bool mPurgeCache; - bool mPurgeCacheOnExit; - bool mPurgeUserDataOnExit; - LLViewerJoystick* joystick; - - bool mSavedFinalSnapshot; - bool mSavePerAccountSettings; // only save per account settings if login succeeded - - boost::optional mForceGraphicsLevel; - - bool mQuitRequested; // User wants to quit, may have modified documents open. - bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim. - U32 mLastAgentControlFlags; - F32 mLastAgentForceUpdate; - struct SettingsFiles* mSettingsLocationList; - - LLWatchdogTimeout* mMainloopTimeout; - - // For performance and metric gathering - class LLThread* mFastTimerLogThread; - - // for tracking viewer<->region circuit death - bool mAgentRegionLastAlive; - LLUUID mAgentRegionLastID; - - LLAllocator mAlloc; - - // llcorehttp library init/shutdown helper - LLAppCoreHttp mAppCoreHttp; - - bool mIsFirstRun; -}; - -// consts from viewer.h -const S32 AGENT_UPDATES_PER_SECOND = 10; -const S32 AGENT_FORCE_UPDATES_PER_SECOND = 1; - -// Globals with external linkage. From viewer.h -// *NOTE:Mani - These will be removed as the Viewer App Cleanup project continues. -// -// "// llstartup" indicates that llstartup is the only client for this global. - -extern LLSD gDebugInfo; -extern bool gShowObjectUpdates; - -typedef enum -{ - LAST_EXEC_NORMAL = 0, - LAST_EXEC_FROZE, - LAST_EXEC_LLERROR_CRASH, - LAST_EXEC_OTHER_CRASH, - LAST_EXEC_LOGOUT_FROZE, - LAST_EXEC_LOGOUT_CRASH -} eLastExecEvent; - -extern eLastExecEvent gLastExecEvent; // llstartup -extern S32 gLastExecDuration; ///< the duration of the previous run in seconds (<0 indicates unknown) - -extern const char* gPlatform; - -extern U32 gFrameCount; -extern U32 gForegroundFrameCount; - -extern LLPumpIO* gServicePump; - -extern U64MicrosecondsImplicit gStartTime; -extern U64MicrosecondsImplicit gFrameTime; // The timestamp of the most-recently-processed frame -extern F32SecondsImplicit gFrameTimeSeconds; // Loses msec precision after ~4.5 hours... -extern F32SecondsImplicit gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds -extern F32 gFPSClamped; // Frames per second, smoothed, weighted toward last frame -extern F32 gFrameDTClamped; - -extern LLTimer gRenderStartTime; -extern LLFrameTimer gForegroundTime; -extern LLFrameTimer gLoggedInTime; - -extern F32 gLogoutMaxTime; -extern LLTimer gLogoutTimer; - -extern S32 gPendingMetricsUploads; - -extern F32 gSimLastTime; -extern F32 gSimFrames; - -extern bool gDisconnected; - -extern LLFrameTimer gRestoreGLTimer; -extern bool gRestoreGL; -extern bool gUseWireframe; - -extern LLMemoryInfo gSysMemory; -extern U64Bytes gMemoryAllocated; - -extern std::string gLastVersionChannel; - -extern LLVector3 gWindVec; -extern LLVector3 gRelativeWindVec; -extern U32 gPacketsIn; -extern bool gPrintMessagesThisFrame; - -extern LLUUID gBlackSquareID; - -extern bool gRandomizeFramerate; -extern bool gPeriodicSlowFrame; - -extern bool gSimulateMemLeak; - -#endif // LL_LLAPPVIEWER_H +/** + * @mainpage + * @mainpage + * + * This is the sources for the Second Life Viewer; + * information on the open source project is at + * https://wiki.secondlife.com/wiki/Open_Source_Portal + * + * The Mercurial repository for the trunk version is at + * https://bitbucket.org/lindenlab/viewer-release + * + * @section source-license Source License + * @verbinclude LICENSE-source.txt + * + * @section artwork-license Artwork License + * @verbinclude LICENSE-logos.txt + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, 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$ + * + * @file llappviewer.h + * @brief The LLAppViewer class declaration + */ + +#ifndef LL_LLAPPVIEWER_H +#define LL_LLAPPVIEWER_H + +#include "llallocator.h" +#include "llapr.h" +#include "llcontrol.h" +#include "llsys.h" // for LLOSInfo +#include "lltimer.h" +#include "llappcorehttp.h" +#include "threadpool_fwd.h" + +#include + +class LLCommandLineParser; +class LLFrameTimer; +class LLPumpIO; +class LLTextureCache; +class LLImageDecodeThread; +class LLTextureFetch; +class LLWatchdogTimeout; +class LLViewerJoystick; +class LLPurgeDiskCacheThread; +class LLViewerRegion; + +extern LLTrace::BlockTimerStatHandle FTM_FRAME; + +class LLAppViewer : public LLApp +{ +public: + LLAppViewer(); + virtual ~LLAppViewer(); + + /** + * @brief Access to the LLAppViewer singleton. + * + * The LLAppViewer singleton is created in main()/WinMain(). + * So don't use it in pre-entry (static initialization) code. + */ + static LLAppViewer* instance() {return sInstance; } + + // + // Main application logic + // + virtual bool init(); // Override to do application initialization + virtual bool cleanup(); // Override to do application cleanup + virtual bool frame(); // Override for application body logic + + // Application control + void flushLFSIO(); // waits for lfs transfers to complete + void forceQuit(); // Puts the viewer into 'shutting down without error' mode. + void fastQuit(S32 error_code = 0); // Shuts down the viewer immediately after sending a logout message + void requestQuit(); // Request a quit. A kinder, gentler quit. + void userQuit(); // The users asks to quit. Confirm, then requestQuit() + void earlyExit(const std::string& name, + const LLSD& substitutions = LLSD()); // Display an error dialog and forcibly quit. + void earlyExitNoNotify(); // Do not display error dialog then forcibly quit. + void abortQuit(); // Called to abort a quit request. + + bool quitRequested() { return mQuitRequested; } + bool logoutRequestSent() { return mLogoutRequestSent; } + bool isSecondInstance() { return mSecondInstance; } + bool isUpdaterMissing(); // In use by tests + bool waitForUpdater(); + + void writeDebugInfo(bool isStatic=true); + + void setServerReleaseNotesURL(const std::string& url) { mServerReleaseNotesURL = url; } + LLSD getViewerInfo() const; + std::string getViewerInfoString(bool default_string = false) const; + + // Report true if under the control of a debugger. A null-op default. + virtual bool beingDebugged() { return false; } + + virtual bool restoreErrorTrap() = 0; // Require platform specific override to reset error handling mechanism. + // return false if the error trap needed restoration. + void checkForCrash(); + + // Thread accessors + static LLTextureCache* getTextureCache() { return sTextureCache; } + static LLImageDecodeThread* getImageDecodeThread() { return sImageDecodeThread; } + static LLTextureFetch* getTextureFetch() { return sTextureFetch; } + static LLPurgeDiskCacheThread* getPurgeDiskCacheThread() { return sPurgeDiskCacheThread; } + + static U32 getTextureCacheVersion() ; + static U32 getObjectCacheVersion() ; + static U32 getDiskCacheVersion() ; + + const std::string& getSerialNumber() { return mSerialNumber; } + + bool getPurgeCache() const { return mPurgeCache; } + + std::string getSecondLifeTitle() const; // The Second Life title. + std::string getWindowTitle() const; // The window display name. + + void forceDisconnect(const std::string& msg); // Force disconnection, with a message to the user. + void badNetworkHandler(); // Cause a crash state due to bad network packet. + + bool hasSavedFinalSnapshot() { return mSavedFinalSnapshot; } + void saveFinalSnapshot(); + + void loadNameCache(); + void saveNameCache(); + + void loadExperienceCache(); + void saveExperienceCache(); + + void removeMarkerFiles(); + + void removeDumpDir(); + // LLAppViewer testing helpers. + // *NOTE: These will potentially crash the viewer. Only for debugging. + virtual void forceErrorLLError(); + virtual void forceErrorLLErrorMsg(); + virtual void forceErrorBreakpoint(); + virtual void forceErrorBadMemoryAccess(); + virtual void forceErrorInfiniteLoop(); + virtual void forceErrorSoftwareException(); + virtual void forceErrorOSSpecificException(); + virtual void forceErrorDriverCrash(); + virtual void forceErrorCoroutineCrash(); + virtual void forceErrorThreadCrash(); + + // The list is found in app_settings/settings_files.xml + // but since they are used explicitly in code, + // the follow consts should also do the trick. + static const std::string sGlobalSettingsName; + + LLCachedControl mRandomizeFramerate; + LLCachedControl mPeriodicSlowFrame; + + // Load settings from the location specified by loction_key. + // Key availale and rules for loading, are specified in + // 'app_settings/settings_files.xml' + bool loadSettingsFromDirectory(const std::string& location_key, + bool set_defaults = false); + + std::string getSettingsFilename(const std::string& location_key, + const std::string& file); + void loadColorSettings(); + + // For thread debugging. + // llstartup needs to control init. + // llworld, send_agent_pause() also controls pause/resume. + void initMainloopTimeout(const std::string& state, F32 secs = -1.0f); + void destroyMainloopTimeout(); + void pauseMainloopTimeout(); + void resumeMainloopTimeout(const std::string& state = "", F32 secs = -1.0f); + void pingMainloopTimeout(const std::string& state, F32 secs = -1.0f); + + // Handle the 'login completed' event. + // *NOTE:Mani Fix this for login abstraction!! + void handleLoginComplete(); + + LLAllocator & getAllocator() { return mAlloc; } + + // On LoginCompleted callback + typedef boost::signals2::signal login_completed_signal_t; + login_completed_signal_t mOnLoginCompleted; + boost::signals2::connection setOnLoginCompletedCallback( const login_completed_signal_t::slot_type& cb ) + { + return mOnLoginCompleted.connect(cb); + } + + void addOnIdleCallback(const boost::function& cb); // add a callback to fire (once) when idle + + void initGeneralThread(); + void purgeUserDataOnExit() { mPurgeUserDataOnExit = true; } + void purgeCache(); // Clear the local cache. + void purgeCacheImmediate(); //clear local cache immediately. + S32 updateTextureThreads(F32 max_time); + + void loadKeyBindings(); + + // mute/unmute the system's master audio + virtual void setMasterSystemAudioMute(bool mute); + virtual bool getMasterSystemAudioMute(); + + // Metrics policy helper statics. + static void metricsUpdateRegion(U64 region_handle); + static void metricsSend(bool enable_reporting); + + // llcorehttp init/shutdown/config information. + LLAppCoreHttp & getAppCoreHttp() { return mAppCoreHttp; } + + void updateNameLookupUrl(const LLViewerRegion* regionp); + +protected: + virtual bool initWindow(); // Initialize the viewer's window. + virtual void initLoggingAndGetLastDuration(); // Initialize log files, logging system + virtual void initConsole() {}; // Initialize OS level debugging console. + virtual bool initHardwareTest() { return true; } // A false result indicates the app should quit. + virtual bool initSLURLHandler(); + virtual bool sendURLToOtherInstance(const std::string& url); + + virtual bool initParseCommandLine(LLCommandLineParser& clp) + { return true; } // Allow platforms to specify the command line args. + + virtual std::string generateSerialNumber() = 0; // Platforms specific classes generate this. + + virtual bool meetsRequirementsForMaximizedStart(); // Used on first login to decide to launch maximized + +private: + + bool doFrame(); + + void initMaxHeapSize(); + bool initThreads(); // Initialize viewer threads, return false on failure. + bool initConfiguration(); // Initialize settings from the command line/config file. + void initStrings(); // Initialize LLTrans machinery + bool initCache(); // Initialize local client cache. + + // We have switched locations of both Mac and Windows cache, make sure + // files migrate and old cache is cleared out. + void migrateCacheDirectory(); + + void cleanupSavedSettings(); // Sets some config data to current or default values during cleanup. + void removeCacheFiles(const std::string& filemask); // Deletes cached files the match the given wildcard. + + void writeSystemInfo(); // Write system info to "debug_info.log" + + void processMarkerFiles(); + static void recordMarkerVersion(LLAPRFile& marker_file); + bool markerIsSameVersion(const std::string& marker_name) const; + + void idle(); + void idleShutdown(); + // update avatar SLID and display name caches + void idleNameCache(); + void idleNetwork(); + + void sendLogoutRequest(); + void disconnectViewer(); + + // *FIX: the app viewer class should be some sort of singleton, no? + // Perhaps its child class is the singleton and this should be an abstract base. + static LLAppViewer* sInstance; + + bool mSecondInstance; // Is this a second instance of the app? + bool mUpdaterNotFound; // True when attempt to start updater failed + + std::string mMarkerFileName; + LLAPRFile mMarkerFile; // A file created to indicate the app is running. + + std::string mLogoutMarkerFileName; + LLAPRFile mLogoutMarkerFile; // A file created to indicate the app is running. + + bool mReportedCrash; + + std::string mServerReleaseNotesURL; + + // Thread objects. + static LLTextureCache* sTextureCache; + static LLImageDecodeThread* sImageDecodeThread; + static LLTextureFetch* sTextureFetch; + static LLPurgeDiskCacheThread* sPurgeDiskCacheThread; + LL::ThreadPool* mGeneralThreadPool; + + S32 mNumSessions; + + std::string mSerialNumber; + bool mPurgeCache; + bool mPurgeCacheOnExit; + bool mPurgeUserDataOnExit; + LLViewerJoystick* joystick; + + bool mSavedFinalSnapshot; + bool mSavePerAccountSettings; // only save per account settings if login succeeded + + boost::optional mForceGraphicsLevel; + + bool mQuitRequested; // User wants to quit, may have modified documents open. + bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim. + U32 mLastAgentControlFlags; + F32 mLastAgentForceUpdate; + struct SettingsFiles* mSettingsLocationList; + + LLWatchdogTimeout* mMainloopTimeout; + + // For performance and metric gathering + class LLThread* mFastTimerLogThread; + + // for tracking viewer<->region circuit death + bool mAgentRegionLastAlive; + LLUUID mAgentRegionLastID; + + LLAllocator mAlloc; + + // llcorehttp library init/shutdown helper + LLAppCoreHttp mAppCoreHttp; + + bool mIsFirstRun; +}; + +// consts from viewer.h +const S32 AGENT_UPDATES_PER_SECOND = 10; +const S32 AGENT_FORCE_UPDATES_PER_SECOND = 1; + +// Globals with external linkage. From viewer.h +// *NOTE:Mani - These will be removed as the Viewer App Cleanup project continues. +// +// "// llstartup" indicates that llstartup is the only client for this global. + +extern LLSD gDebugInfo; +extern bool gShowObjectUpdates; + +typedef enum +{ + LAST_EXEC_NORMAL = 0, + LAST_EXEC_FROZE, + LAST_EXEC_LLERROR_CRASH, + LAST_EXEC_OTHER_CRASH, + LAST_EXEC_LOGOUT_FROZE, + LAST_EXEC_LOGOUT_CRASH +} eLastExecEvent; + +extern eLastExecEvent gLastExecEvent; // llstartup +extern S32 gLastExecDuration; ///< the duration of the previous run in seconds (<0 indicates unknown) + +extern const char* gPlatform; + +extern U32 gFrameCount; +extern U32 gForegroundFrameCount; + +extern LLPumpIO* gServicePump; + +extern U64MicrosecondsImplicit gStartTime; +extern U64MicrosecondsImplicit gFrameTime; // The timestamp of the most-recently-processed frame +extern F32SecondsImplicit gFrameTimeSeconds; // Loses msec precision after ~4.5 hours... +extern F32SecondsImplicit gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds +extern F32 gFPSClamped; // Frames per second, smoothed, weighted toward last frame +extern F32 gFrameDTClamped; + +extern LLTimer gRenderStartTime; +extern LLFrameTimer gForegroundTime; +extern LLFrameTimer gLoggedInTime; + +extern F32 gLogoutMaxTime; +extern LLTimer gLogoutTimer; + +extern S32 gPendingMetricsUploads; + +extern F32 gSimLastTime; +extern F32 gSimFrames; + +extern bool gDisconnected; + +extern LLFrameTimer gRestoreGLTimer; +extern bool gRestoreGL; +extern bool gUseWireframe; + +extern LLMemoryInfo gSysMemory; +extern U64Bytes gMemoryAllocated; + +extern std::string gLastVersionChannel; + +extern LLVector3 gWindVec; +extern LLVector3 gRelativeWindVec; +extern U32 gPacketsIn; +extern bool gPrintMessagesThisFrame; + +extern LLUUID gBlackSquareID; + +extern bool gRandomizeFramerate; +extern bool gPeriodicSlowFrame; + +extern bool gSimulateMemLeak; + +#endif // LL_LLAPPVIEWER_H -- cgit v1.2.3