MAINT-7739 Make LLOSInfo a Singleton

master
andreykproductengine 2017-08-25 20:26:25 +03:00
parent e46f66ff31
commit c21b3bbacc
8 changed files with 22 additions and 22 deletions

View File

@ -37,13 +37,14 @@
//
#include "llsd.h"
#include "llsingleton.h"
#include <iosfwd>
#include <string>
class LL_COMMON_API LLOSInfo
class LL_COMMON_API LLOSInfo : public LLSingleton<LLOSInfo>
{
LLSINGLETON(LLOSInfo);
public:
LLOSInfo();
void stream(std::ostream& s) const;
const std::string& getOSString() const;

View File

@ -733,7 +733,7 @@ LLAppViewer::LLAppViewer()
//
LLLoginInstance::instance().setUpdaterService(mUpdater.get());
LLLoginInstance::instance().setPlatformInfo(gPlatform, getOSInfo().getOSVersionString());
LLLoginInstance::instance().setPlatformInfo(gPlatform, LLOSInfo::instance().getOSVersionString());
}
LLAppViewer::~LLAppViewer()
@ -3110,7 +3110,7 @@ void LLAppViewer::initUpdater()
mUpdater->initialize(channel,
version,
gPlatform,
getOSInfo().getOSVersionString(),
LLOSInfo::instance().getOSVersionString(),
unique_id,
willing_to_test
);
@ -3192,10 +3192,13 @@ bool LLAppViewer::initWindow()
#ifdef LL_DARWIN
//Satisfy both MAINT-3135 (OSX 10.6 and earlier) MAINT-3288 (OSX 10.7 and later)
if (getOSInfo().mMajorVer == 10 && getOSInfo().mMinorVer < 7)
if ( getOSInfo().mMinorVer == 6 && getOSInfo().mBuild < 8 )
gViewerWindow->getWindow()->setOldResize(true);
//Satisfy both MAINT-3135 (OSX 10.6 and earlier) MAINT-3288 (OSX 10.7 and later)
LLOSInfo& os_info = LLOSInfo::instance();
if (os_info.mMajorVer == 10 && os_info.mMinorVer < 7)
{
if ( os_info.mMinorVer == 6 && os_info.mBuild < 8 )
gViewerWindow->getWindow()->setOldResize(true);
}
#endif
if (gSavedSettings.getBOOL("WindowMaximized"))
@ -3337,7 +3340,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["CPU"] = gSysCPU.getCPUString();
info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits<LLUnits::Megabytes>());
// Moved hack adjustment to Windows memory size into llsys.cpp
info["OS_VERSION"] = LLAppViewer::instance()->getOSInfo().getOSString();
info["OS_VERSION"] = LLOSInfo::instance().getOSString();
info["GRAPHICS_CARD_VENDOR"] = (const char*)(glGetString(GL_VENDOR));
info["GRAPHICS_CARD"] = (const char*)(glGetString(GL_RENDERER));
@ -3659,7 +3662,7 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB().value());
gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated.valueInUnits<LLUnits::Kilobytes>());
gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple();
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.
@ -3701,8 +3704,8 @@ void LLAppViewer::writeSystemInfo()
// query some system information
LL_INFOS("SystemInfo") << "CPU info:\n" << gSysCPU << LL_ENDL;
LL_INFOS("SystemInfo") << "Memory info:\n" << gSysMemory << LL_ENDL;
LL_INFOS("SystemInfo") << "OS: " << getOSInfo().getOSStringSimple() << LL_ENDL;
LL_INFOS("SystemInfo") << "OS info: " << getOSInfo() << LL_ENDL;
LL_INFOS("SystemInfo") << "OS: " << LLOSInfo::instance().getOSStringSimple() << LL_ENDL;
LL_INFOS("SystemInfo") << "OS info: " << LLOSInfo::instance() << LL_ENDL;
gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile");
gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName();

View File

@ -98,8 +98,6 @@ public:
void writeDebugInfo(bool isStatic=true);
const LLOSInfo& getOSInfo() const { return mSysOSInfo; }
void setServerReleaseNotesURL(const std::string& url) { mServerReleaseNotesURL = url; }
LLSD getViewerInfo() const;
std::string getViewerInfoString() const;
@ -270,8 +268,6 @@ private:
std::string mLogoutMarkerFileName;
LLAPRFile mLogoutMarkerFile; // A file created to indicate the app is running.
LLOSInfo mSysOSInfo;
bool mReportedCrash;
std::string mServerReleaseNotesURL;

View File

@ -486,7 +486,7 @@ void LLFeatureManager::fetchFeatureTableCoro(std::string tableName)
#if LL_WINDOWS
std::string os_string = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
std::string os_string = LLOSInfo::instance().getOSStringSimple();
std::string filename;
if (os_string.find("Microsoft Windows XP") == 0)
@ -767,7 +767,7 @@ void LLFeatureManager::applyBaseMasks()
}
#if LL_DARWIN
const LLOSInfo& osInfo = LLAppViewer::instance()->getOSInfo();
const LLOSInfo& osInfo = LLOSInfo::instance();
if (osInfo.mMajorVer == 10 && osInfo.mMinorVer < 7)
{
maskFeatures("OSX_10_6_8");

View File

@ -791,7 +791,7 @@ void LLPanelLogin::loadLoginPage()
params["grid"] = LLGridManager::getInstance()->getGridId();
// add OS info
params["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
params["os"] = LLOSInfo::instance().getOSStringSimple();
// sourceid
params["sourceid"] = gSavedSettings.getString("sourceid");

View File

@ -345,7 +345,7 @@ bool idle_startup()
const std::string delims (" ");
std::string system;
int begIdx, endIdx;
std::string osString = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
std::string osString = LLOSInfo::instance().getOSStringSimple();
begIdx = osString.find_first_not_of (delims);
endIdx = osString.find_first_of (delims, begIdx);

View File

@ -489,7 +489,7 @@ void send_stats()
LLSD &system = body["system"];
system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB().value();
system["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
system["os"] = LLOSInfo::instance().getOSStringSimple();
system["cpu"] = gSysCPU.getCPUString();
unsigned char MACAddress[MAC_ADDRESS_BYTES];
LLUUID::getNodeID(MACAddress);

View File

@ -192,7 +192,7 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
substitution["CHANNEL"] = LLVersionInfo::getChannel();
substitution["GRID"] = LLGridManager::getInstance()->getGridId();
substitution["GRID_LOWERCASE"] = utf8str_tolower(LLGridManager::getInstance()->getGridId());
substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
substitution["OS"] = LLOSInfo::instance().getOSStringSimple();
substitution["SESSION_ID"] = gAgent.getSessionID();
substitution["FIRST_LOGIN"] = gAgent.isFirstLogin();