-
Notifications
You must be signed in to change notification settings - Fork 2
/
crashpad.cc
63 lines (53 loc) · 1.85 KB
/
crashpad.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "crashpad.hpp"
#include <crashpad/client/crash_report_database.h>
#include <crashpad/client/crashpad_client.h>
#include <crashpad/client/settings.h>
namespace Dump {
class CrashPad::CrashPadPrivate
{
public:
explicit CrashPadPrivate(CrashPad *q)
: q_ptr(q)
, crashpadClientPtr(new crashpad::CrashpadClient)
{}
~CrashPadPrivate() {}
CrashPad *q_ptr = nullptr;
QScopedPointer<crashpad::CrashpadClient> crashpadClientPtr;
};
CrashPad::CrashPad(const QString &dumpPath,
const QString &libexecPath,
const QString &reportUrl,
bool crashReportingEnabled,
QObject *parent)
: QObject(parent)
, d_ptr(new CrashPadPrivate(this))
{
auto handlerPath = libexecPath + "/crashpad_handler";
#ifdef Q_OS_WIN
handlerPath += ".exe";
base::FilePath database(dumpPath.toStdWString());
base::FilePath handler(handlerPath.toStdWString());
#else
base::FilePath database(dumpPath.toStdString());
base::FilePath handler(handlerPath.toStdString());
#endif
#ifdef Q_OS_LINUX
bool asynchronous_start = false;
#else
bool asynchronous_start = true;
#endif
auto dbPtr = crashpad::CrashReportDatabase::Initialize(database);
if (dbPtr && (dbPtr->GetSettings() != nullptr)) {
dbPtr->GetSettings()->SetUploadsEnabled(crashReportingEnabled);
}
d_ptr->crashpadClientPtr->StartHandler(handler,
database,
database,
reportUrl.toStdString(),
{},
{"--no-rate-limit"},
true,
asynchronous_start);
}
CrashPad::~CrashPad() {}
} // namespace Dump