summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp67
1 files changed, 29 insertions, 38 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 2ddae0cfc2..c94ec70766 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -103,7 +103,6 @@
#include "llscenemonitor.h"
#include "llavatarrenderinfoaccountant.h"
#include "lllocalbitmaps.h"
-#include "llskinningutil.h"
// Linden library includes
#include "llavatarnamecache.h"
@@ -674,7 +673,8 @@ LLAppViewer::LLAppViewer()
mReportedCrash(false),
mNumSessions(0),
mPurgeCache(false),
- mPurgeOnExit(false),
+ mPurgeCacheOnExit(false),
+ mPurgeUserDataOnExit(false),
mSecondInstance(false),
mSavedFinalSnapshot(false),
mSavePerAccountSettings(false), // don't save settings on logout unless login succeeded.
@@ -777,7 +777,7 @@ bool LLAppViewer::init()
// initialize LLWearableType translation bridge.
// Memory will be cleaned up in ::cleanupClass()
- LLWearableType::initClass(new LLUITranslationBridge());
+ LLWearableType::initParamSingleton(new LLUITranslationBridge());
// initialize SSE options
LLVector4a::initClass();
@@ -801,9 +801,6 @@ bool LLAppViewer::init()
LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ;
- // initialize skinning util
- LLSkinningUtil::initClass();
-
//set the max heap size.
initMaxHeapSize() ;
LLCoros::instance().setStackSize(gSavedSettings.getS32("CoroutineStackSize"));
@@ -851,11 +848,10 @@ bool LLAppViewer::init()
settings_map["floater"] = &gSavedSettings; // *TODO: New settings file
settings_map["account"] = &gSavedPerAccountSettings;
- LLUI::initClass(settings_map,
+ LLUI::initParamSingleton(settings_map,
LLUIImageList::getInstance(),
ui_audio_callback,
- deferred_ui_audio_callback,
- &LLUI::getScaleFactor());
+ deferred_ui_audio_callback);
LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ;
// NOW LLUI::getLanguage() should work. gDirUtilp must know the language
@@ -899,8 +895,6 @@ bool LLAppViewer::init()
// LLKeyboard relies on LLUI to know what some accelerator keys are called.
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));
@@ -908,7 +902,7 @@ bool LLAppViewer::init()
LLUrlAction::setExecuteSLURLCallback(&LLURLDispatcher::dispatchFromTextEditor);
// Let code in llui access the viewer help floater
- LLUI::sHelpImpl = LLViewerHelp::getInstance();
+ LLUI::getInstance()->mHelpImpl = LLViewerHelp::getInstance();
LL_INFOS("InitInfo") << "UI initialization is done." << LL_ENDL ;
@@ -1209,9 +1203,6 @@ bool LLAppViewer::init()
<< LL_ENDL;
}
- LLViewerMedia::initClass();
- LL_INFOS("InitInfo") << "Viewer media initialized." << LL_ENDL ;
-
LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match;
//EXT-7013 - On windows for some locale (Japanese) standard
@@ -1251,7 +1242,7 @@ bool LLAppViewer::init()
// Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
LLVoiceChannel::initClass();
- LLVoiceClient::getInstance()->init(gServicePump);
+ LLVoiceClient::initParamSingleton(gServicePump);
LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLFloaterIMContainer::onCurrentChannelChanged, _1), true);
joystick = LLViewerJoystick::getInstance();
@@ -1754,8 +1745,6 @@ bool LLAppViewer::cleanup()
gTransferManager.cleanup();
#endif
- SUBSYSTEM_CLEANUP(LLLocalBitmapMgr);
-
// Note: this is where gWorldMap used to be deleted.
// Note: this is where gHUDManager used to be deleted.
@@ -1898,12 +1887,9 @@ bool LLAppViewer::cleanup()
//end_messaging_system();
- SUBSYSTEM_CLEANUP(LLFollowCamMgr);
- //SUBSYSTEM_CLEANUP(LLVolumeMgr);
LLPrimitive::cleanupVolumeManager();
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).
@@ -1967,7 +1953,7 @@ bool LLAppViewer::cleanup()
LLConversationLog::instance().cache();
}
- if (mPurgeOnExit)
+ if (mPurgeCacheOnExit)
{
LL_INFOS() << "Purging all cache files on exit" << LL_ENDL;
gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*");
@@ -2008,6 +1994,14 @@ bool LLAppViewer::cleanup()
}
}
+ if (mPurgeUserDataOnExit)
+ {
+ // Ideally we should not save anything from this session since it is going to be purged now,
+ // but this is a very 'rare' case (user deleting himself), not worth overcomplicating 'save&cleanup' code
+ std::string user_path = gDirUtilp->getOSUserAppDir() + gDirUtilp->getDirDelimiter() + LLStartUp::getUserId();
+ gDirUtilp->deleteDirAndContents(user_path);
+ }
+
// Delete workers first
// shotdown all worker threads before deleting them in case of co-dependencies
mAppCoreHttp.requestStop();
@@ -2058,13 +2052,10 @@ bool LLAppViewer::cleanup()
//Note:
//SUBSYSTEM_CLEANUP(LLViewerMedia) has to be put before gTextureList.shutdown()
//because some new image might be generated during cleaning up media. --bao
- SUBSYSTEM_CLEANUP(LLViewerMedia);
- 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);
SUBSYSTEM_CLEANUP(LLLFSThread);
@@ -2112,8 +2103,6 @@ bool LLAppViewer::cleanup()
SUBSYSTEM_CLEANUP(LLProxy);
LLCore::LLHttp::cleanup();
- SUBSYSTEM_CLEANUP(LLWearableType);
-
LLMainLoopRepeater::instance().stop();
ll_close_fail_log();
@@ -2175,7 +2164,7 @@ bool LLAppViewer::initThreads()
{
static const bool enable_threads = true;
- LLImage::initClass(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));
+ LLImage::initParamSingleton(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));
LLVFSThread::initClass(enable_threads && false);
LLLFSThread::initClass(enable_threads && false);
@@ -3059,7 +3048,7 @@ bool LLAppViewer::initWindow()
gViewerWindow->getWindow()->maximize();
}
- LLUI::sWindow = gViewerWindow->getWindow();
+ LLUI::getInstance()->mWindow = gViewerWindow->getWindow();
// Show watch cursor
gViewerWindow->setCursor(UI_CURSOR_WAIT);
@@ -4162,7 +4151,7 @@ bool LLAppViewer::initCache()
mPurgeCache = false;
BOOL read_only = mSecondInstance ? TRUE : FALSE;
LLAppViewer::getTextureCache()->setReadOnly(read_only) ;
- LLVOCache::getInstance()->setReadOnly(read_only);
+ LLVOCache::initParamSingleton(read_only);
bool texture_cache_mismatch = false;
if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion())
@@ -4234,7 +4223,8 @@ bool LLAppViewer::initCache()
S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch);
texture_cache_size -= extra;
- LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion()) ;
+
+ LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion());
LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS"));
@@ -4487,7 +4477,7 @@ void LLAppViewer::badNetworkHandler()
// Flush all of our caches on exit in the case of disconnect due to
// invalid packets.
- mPurgeOnExit = TRUE;
+ mPurgeCacheOnExit = TRUE;
std::ostringstream message;
message <<
@@ -4565,7 +4555,7 @@ void LLAppViewer::loadNameCache()
llifstream name_cache_stream(filename.c_str());
if(name_cache_stream.is_open())
{
- if ( ! LLAvatarNameCache::importFile(name_cache_stream))
+ if ( ! LLAvatarNameCache::getInstance()->importFile(name_cache_stream))
{
LL_WARNS("AppInit") << "removing invalid '" << filename << "'" << LL_ENDL;
name_cache_stream.close();
@@ -4592,7 +4582,7 @@ void LLAppViewer::saveNameCache()
llofstream name_cache_stream(filename.c_str());
if(name_cache_stream.is_open())
{
- LLAvatarNameCache::exportFile(name_cache_stream);
+ LLAvatarNameCache::getInstance()->exportFile(name_cache_stream);
}
// real names cache
@@ -5199,7 +5189,8 @@ void LLAppViewer::idleNameCache()
// granted to neighbor regions before the main agent gets there. Can't
// do it in the move-into-region code because cap not guaranteed to be
// granted yet, for example on teleport.
- bool had_capability = LLAvatarNameCache::hasNameLookupURL();
+ LLAvatarNameCache *name_cache = LLAvatarNameCache::getInstance();
+ bool had_capability = LLAvatarNameCache::getInstance()->hasNameLookupURL();
std::string name_lookup_url;
name_lookup_url.reserve(128); // avoid a memory allocation below
name_lookup_url = region->getCapability("GetDisplayNames");
@@ -5216,12 +5207,12 @@ void LLAppViewer::idleNameCache()
{
name_lookup_url += '/';
}
- LLAvatarNameCache::setNameLookupURL(name_lookup_url);
+ name_cache->setNameLookupURL(name_lookup_url);
}
else
{
// Display names not available on this region
- LLAvatarNameCache::setNameLookupURL( std::string() );
+ name_cache->setNameLookupURL( std::string() );
}
// Error recovery - did we change state?
@@ -5231,7 +5222,7 @@ void LLAppViewer::idleNameCache()
LLVOAvatar::invalidateNameTags();
}
- LLAvatarNameCache::idle();
+ name_cache->idle();
}
//