mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:02:55 +02:00
Rename crash handler files
This commit is contained in:
parent
4cd94a32b8
commit
20727378e2
10 changed files with 104 additions and 96 deletions
|
@ -150,8 +150,8 @@
|
||||||
#include "audio/AudioScope.h"
|
#include "audio/AudioScope.h"
|
||||||
#include "avatar/AvatarManager.h"
|
#include "avatar/AvatarManager.h"
|
||||||
#include "avatar/MyHead.h"
|
#include "avatar/MyHead.h"
|
||||||
|
#include "CrashRecoveryHandler.h"
|
||||||
#include "CrashHandler.h"
|
#include "CrashHandler.h"
|
||||||
#include "Crashpad.h"
|
|
||||||
#include "devices/DdeFaceTracker.h"
|
#include "devices/DdeFaceTracker.h"
|
||||||
#include "DiscoverabilityManager.h"
|
#include "DiscoverabilityManager.h"
|
||||||
#include "GLCanvas.h"
|
#include "GLCanvas.h"
|
||||||
|
@ -792,7 +792,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||||
|
|
||||||
bool previousSessionCrashed { false };
|
bool previousSessionCrashed { false };
|
||||||
if (!inTestMode) {
|
if (!inTestMode) {
|
||||||
previousSessionCrashed = CrashHandler::checkForResetSettings(runningMarkerExisted, suppressPrompt);
|
previousSessionCrashed = CrashRecoveryHandler::checkForResetSettings(runningMarkerExisted, suppressPrompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get dir to use for cache
|
// get dir to use for cache
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
//
|
|
||||||
// Breakpad.h
|
|
||||||
// interface/src
|
|
||||||
//
|
|
||||||
// Created by Gabriel Calero & Cristian Duarte on 06/06/18
|
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef hifi_Breakpad_h
|
|
||||||
#define hifi_Breakpad_h
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
bool startCrashHandler();
|
|
||||||
void setCrashAnnotation(std::string name, std::string value);
|
|
||||||
|
|
||||||
#endif // hifi_Crashpad_h
|
|
|
@ -2,8 +2,8 @@
|
||||||
// CrashHandler.h
|
// CrashHandler.h
|
||||||
// interface/src
|
// interface/src
|
||||||
//
|
//
|
||||||
// Created by David Rowe on 24 Aug 2015.
|
// Created by Clement Brisset on 01/19/18.
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
@ -12,22 +12,21 @@
|
||||||
#ifndef hifi_CrashHandler_h
|
#ifndef hifi_CrashHandler_h
|
||||||
#define hifi_CrashHandler_h
|
#define hifi_CrashHandler_h
|
||||||
|
|
||||||
#include <QString>
|
#include <string>
|
||||||
|
|
||||||
class CrashHandler {
|
#if HAS_CRASHPAD
|
||||||
|
|
||||||
public:
|
bool startCrashHandler();
|
||||||
static bool checkForResetSettings(bool wasLikelyCrash, bool suppressPrompt = false);
|
void setCrashAnnotation(std::string name, std::string value);
|
||||||
|
|
||||||
private:
|
#elif HAS_BREAKPAD
|
||||||
enum Action {
|
|
||||||
DELETE_INTERFACE_INI,
|
|
||||||
RETAIN_IMPORTANT_INFO,
|
|
||||||
DO_NOTHING
|
|
||||||
};
|
|
||||||
|
|
||||||
static Action promptUserForAction(bool showCrashMessage);
|
bool startCrashHandler();
|
||||||
static void handleCrash(Action action);
|
void setCrashAnnotation(std::string name, std::string value);
|
||||||
};
|
|
||||||
|
|
||||||
#endif // hifi_CrashHandler_h
|
#else
|
||||||
|
|
||||||
|
bool startCrashHandler();
|
||||||
|
void setCrashAnnotation(std::string name, std::string value);
|
||||||
|
|
||||||
|
#endif // hifi_Crashpad_h
|
||||||
|
|
|
@ -1,28 +1,31 @@
|
||||||
//
|
//
|
||||||
// Breakpad.cpp
|
// Crashpad.cpp
|
||||||
// interface/src
|
// interface/src
|
||||||
//
|
//
|
||||||
// Created by Gabriel Calero & Cristian Duarte on 06/06/18
|
// Created by Clement Brisset on 01/19/18.
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "Crashpad.h"
|
#include "CrashHandler.h"
|
||||||
|
|
||||||
#if defined(HAS_BREAKPAD)
|
#if HAS_BREAKPAD
|
||||||
#include <QDebug>
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#include <client/linux/handler/exception_handler.h>
|
#include <client/linux/handler/exception_handler.h>
|
||||||
#include <client/linux/handler/minidump_descriptor.h>
|
#include <client/linux/handler/minidump_descriptor.h>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QMap>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtAndroidExtras/QAndroidJniObject>
|
#include <QtAndroidExtras/QAndroidJniObject>
|
||||||
#include <QMap>
|
|
||||||
#include <SettingHelpers.h>
|
|
||||||
#include <mutex>
|
|
||||||
|
|
||||||
google_breakpad::ExceptionHandler *gBreakpadHandler;
|
#include <SettingHelpers.h>
|
||||||
|
|
||||||
|
google_breakpad::ExceptionHandler* gBreakpadHandler;
|
||||||
|
|
||||||
std::mutex annotationMutex;
|
std::mutex annotationMutex;
|
||||||
QMap<QString, QString> annotations;
|
QMap<QString, QString> annotations;
|
||||||
|
@ -52,11 +55,7 @@ void setCrashAnnotation(std::string name, std::string value) {
|
||||||
std::lock_guard<std::mutex> guard(annotationMutex);
|
std::lock_guard<std::mutex> guard(annotationMutex);
|
||||||
QString qName = QString::fromStdString(name);
|
QString qName = QString::fromStdString(name);
|
||||||
QString qValue = QString::fromStdString(value);
|
QString qValue = QString::fromStdString(value);
|
||||||
if(!annotations.contains(qName)) {
|
|
||||||
annotations.insert(qName, qValue);
|
|
||||||
} else {
|
|
||||||
annotations[qName] = qValue;
|
annotations[qName] = qValue;
|
||||||
}
|
|
||||||
|
|
||||||
QSettings settings(obbDir() + "/annotations.json", JSON_FORMAT);
|
QSettings settings(obbDir() + "/annotations.json", JSON_FORMAT);
|
||||||
settings.clear();
|
settings.clear();
|
|
@ -9,7 +9,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "Crashpad.h"
|
#include "CrashHandler.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -114,14 +114,4 @@ void setCrashAnnotation(std::string name, std::string value) {
|
||||||
crashpadAnnotations->SetKeyValue(name, value);
|
crashpadAnnotations->SetKeyValue(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif !defined(HAS_BREAKPAD)
|
|
||||||
|
|
||||||
bool startCrashHandler() {
|
|
||||||
qDebug() << "No crash handler available.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCrashAnnotation(std::string name, std::string value) {
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
27
interface/src/CrashHandler_None.cpp
Normal file
27
interface/src/CrashHandler_None.cpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
//
|
||||||
|
// Crashpad.cpp
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by Clement Brisset on 01/19/18.
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "CrashHandler.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#if !defined(HAS_CRASHPAD) && !defined(HAS_BREAKPAD)
|
||||||
|
|
||||||
|
bool startCrashHandler() {
|
||||||
|
qDebug() << "No crash handler available.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCrashAnnotation(std::string name, std::string value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// CrashHandler.cpp
|
// CrashRecoveryHandler.cpp
|
||||||
// interface/src
|
// interface/src
|
||||||
//
|
//
|
||||||
// Created by David Rowe on 24 Aug 2015.
|
// Created by David Rowe on 24 Aug 2015.
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "CrashHandler.h"
|
#include "CrashRecoveryHandler.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
#include <SettingHelpers.h>
|
#include <SettingHelpers.h>
|
||||||
|
|
||||||
|
|
||||||
bool CrashHandler::checkForResetSettings(bool wasLikelyCrash, bool suppressPrompt) {
|
bool CrashRecoveryHandler::checkForResetSettings(bool wasLikelyCrash, bool suppressPrompt) {
|
||||||
QSettings::setDefaultFormat(JSON_FORMAT);
|
QSettings::setDefaultFormat(JSON_FORMAT);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("Developer");
|
settings.beginGroup("Developer");
|
||||||
|
@ -59,7 +59,7 @@ bool CrashHandler::checkForResetSettings(bool wasLikelyCrash, bool suppressPromp
|
||||||
return wasLikelyCrash;
|
return wasLikelyCrash;
|
||||||
}
|
}
|
||||||
|
|
||||||
CrashHandler::Action CrashHandler::promptUserForAction(bool showCrashMessage) {
|
CrashRecoveryHandler::Action CrashRecoveryHandler::promptUserForAction(bool showCrashMessage) {
|
||||||
QDialog crashDialog;
|
QDialog crashDialog;
|
||||||
QLabel* label;
|
QLabel* label;
|
||||||
if (showCrashMessage) {
|
if (showCrashMessage) {
|
||||||
|
@ -94,20 +94,20 @@ CrashHandler::Action CrashHandler::promptUserForAction(bool showCrashMessage) {
|
||||||
|
|
||||||
if (result == QDialog::Accepted) {
|
if (result == QDialog::Accepted) {
|
||||||
if (option1->isChecked()) {
|
if (option1->isChecked()) {
|
||||||
return CrashHandler::DELETE_INTERFACE_INI;
|
return CrashRecoveryHandler::DELETE_INTERFACE_INI;
|
||||||
}
|
}
|
||||||
if (option2->isChecked()) {
|
if (option2->isChecked()) {
|
||||||
return CrashHandler::RETAIN_IMPORTANT_INFO;
|
return CrashRecoveryHandler::RETAIN_IMPORTANT_INFO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dialog cancelled or "do nothing" option chosen
|
// Dialog cancelled or "do nothing" option chosen
|
||||||
return CrashHandler::DO_NOTHING;
|
return CrashRecoveryHandler::DO_NOTHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrashHandler::handleCrash(CrashHandler::Action action) {
|
void CrashRecoveryHandler::handleCrash(CrashRecoveryHandler::Action action) {
|
||||||
if (action != CrashHandler::DELETE_INTERFACE_INI && action != CrashHandler::RETAIN_IMPORTANT_INFO) {
|
if (action != CrashRecoveryHandler::DELETE_INTERFACE_INI && action != CrashRecoveryHandler::RETAIN_IMPORTANT_INFO) {
|
||||||
// CrashHandler::DO_NOTHING or unexpected value
|
// CrashRecoveryHandler::DO_NOTHING or unexpected value
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ void CrashHandler::handleCrash(CrashHandler::Action action) {
|
||||||
QUrl address;
|
QUrl address;
|
||||||
bool tutorialComplete = false;
|
bool tutorialComplete = false;
|
||||||
|
|
||||||
if (action == CrashHandler::RETAIN_IMPORTANT_INFO) {
|
if (action == CrashRecoveryHandler::RETAIN_IMPORTANT_INFO) {
|
||||||
// Read avatar info
|
// Read avatar info
|
||||||
|
|
||||||
// Location and orientation
|
// Location and orientation
|
||||||
|
@ -151,7 +151,7 @@ void CrashHandler::handleCrash(CrashHandler::Action action) {
|
||||||
settingsFile.remove();
|
settingsFile.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == CrashHandler::RETAIN_IMPORTANT_INFO) {
|
if (action == CrashRecoveryHandler::RETAIN_IMPORTANT_INFO) {
|
||||||
// Write avatar info
|
// Write avatar info
|
||||||
|
|
||||||
// Location and orientation
|
// Location and orientation
|
33
interface/src/CrashRecoveryHandler.h
Normal file
33
interface/src/CrashRecoveryHandler.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
//
|
||||||
|
// CrashRecoveryHandler.h
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by David Rowe on 24 Aug 2015.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_CrashHandler_h
|
||||||
|
#define hifi_CrashHandler_h
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class CrashRecoveryHandler {
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool checkForResetSettings(bool wasLikelyCrash, bool suppressPrompt = false);
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum Action {
|
||||||
|
DELETE_INTERFACE_INI,
|
||||||
|
RETAIN_IMPORTANT_INFO,
|
||||||
|
DO_NOTHING
|
||||||
|
};
|
||||||
|
|
||||||
|
static Action promptUserForAction(bool showCrashMessage);
|
||||||
|
static void handleCrash(Action action);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_CrashHandler_h
|
|
@ -1,20 +0,0 @@
|
||||||
//
|
|
||||||
// Crashpad.h
|
|
||||||
// interface/src
|
|
||||||
//
|
|
||||||
// Created by Clement Brisset on 01/19/18.
|
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef hifi_Crashpad_h
|
|
||||||
#define hifi_Crashpad_h
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
bool startCrashHandler();
|
|
||||||
void setCrashAnnotation(std::string name, std::string value);
|
|
||||||
|
|
||||||
#endif // hifi_Crashpad_h
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <UserActivityLogger.h>
|
#include <UserActivityLogger.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
|
|
||||||
#include "Crashpad.h"
|
#include "CrashHandler.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
|
|
||||||
const Discoverability::Mode DEFAULT_DISCOVERABILITY_MODE = Discoverability::Connections;
|
const Discoverability::Mode DEFAULT_DISCOVERABILITY_MODE = Discoverability::Connections;
|
||||||
|
|
Loading…
Reference in a new issue