6969// ////////////////////
7070// STATIC VARIABLES //
7171// ////////////////////
72+ std::vector<nlohmann::json> breadcrumbs;
73+ std::mutex messageMutex;
74+ std::vector<std::string> warnings;
75+ std::queue<std::pair<int , std::string>> lastActions;
7276#ifdef WIN32
7377// Global/static variables
7478std::vector<std::string> handledOBSCrashes;
7579PDH_HQUERY cpuQuery;
7680PDH_HCOUNTER cpuTotal;
77- std::vector<nlohmann::json> breadcrumbs;
78- std::queue<std::pair<int , std::string>> lastActions;
79- std::vector<std::string> warnings;
80- std::mutex messageMutex;
8181util::MetricsProvider metricsClient;
8282LPTOP_LEVEL_EXCEPTION_FILTER crashpadInternalExceptionFilterMethod = nullptr ;
8383HANDLE memoryDumpEvent = INVALID_HANDLE_VALUE ;
@@ -998,16 +998,12 @@ nlohmann::json util::CrashManager::RequestOBSLog(OBSLogType type)
998998
999999nlohmann::json util::CrashManager::ComputeBreadcrumbs ()
10001000{
1001- #ifdef WIN32
10021001 nlohmann::json result = nlohmann::json::array ();
10031002
10041003 for (auto &msg : breadcrumbs)
10051004 result.push_back (msg);
10061005
10071006 return result;
1008- #else
1009- return NULL ;
1010- #endif
10111007}
10121008
10131009nlohmann::json util::CrashManager::ComputeActions ()
@@ -1036,16 +1032,12 @@ nlohmann::json util::CrashManager::ComputeActions()
10361032
10371033nlohmann::json util::CrashManager::ComputeWarnings ()
10381034{
1039- #ifdef WIN32
10401035 nlohmann::json result;
10411036
10421037 for (auto &msg : warnings)
10431038 result.push_back (msg);
10441039
10451040 return result;
1046- #else
1047- return NULL ;
1048- #endif
10491041}
10501042
10511043void BindCrtHandlesToStdHandles (bool bindStdIn, bool bindStdOut, bool bindStdErr)
@@ -1203,15 +1195,12 @@ void util::CrashManager::IPCValuesToData(const std::vector<ipc::value> &values,
12031195
12041196void util::CrashManager::AddWarning (const std::string &warning)
12051197{
1206- #ifdef WIN32
12071198 std::lock_guard<std::mutex> lock (messageMutex);
12081199 warnings.push_back (warning);
1209- #endif
12101200}
12111201
12121202void RegisterAction (const std::string &message)
12131203{
1214- #ifdef WIN32
12151204 static const int MaximumActionsRegistered = 50 ;
12161205 std::lock_guard<std::mutex> lock (messageMutex);
12171206
@@ -1224,34 +1213,27 @@ void RegisterAction(const std::string &message)
12241213 lastActions.pop ();
12251214 }
12261215 }
1227- #endif
12281216}
12291217
12301218void util::CrashManager::AddBreadcrumb (const nlohmann::json &message)
12311219{
1232- #ifdef WIN32
12331220 std::lock_guard<std::mutex> lock (messageMutex);
12341221 breadcrumbs.push_back (message);
1235- #endif
12361222}
12371223
12381224void util::CrashManager::AddBreadcrumb (const std::string &message)
12391225{
1240- #ifdef WIN32
12411226 nlohmann::json j = nlohmann::json::array ();
12421227 j.push_back ({{message}});
12431228
12441229 std::lock_guard<std::mutex> lock (messageMutex);
12451230 breadcrumbs.push_back (j);
1246- #endif
12471231}
12481232
12491233void util::CrashManager::ClearBreadcrumbs ()
12501234{
1251- #ifdef WIN32
12521235 std::lock_guard<std::mutex> lock (messageMutex);
12531236 breadcrumbs.clear ();
1254- #endif
12551237}
12561238
12571239void util::CrashManager::setAppState (const std::string &newState)
0 commit comments