Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
CrashpadConfigurer Class Referencefinal

#include <CrashpadConfigurer.h>

Collaboration diagram for CrashpadConfigurer:
[legend]

Public Member Functions

CrashpadConfigurerSetHandlerPathUTF8 (const std::string &handlerPath)
 
CrashpadConfigurerSetDatabasePathUTF8 (const std::string &database)
 
CrashpadConfigurerSetMetricsDirUTF8 (const std::string &metricsDir)
 
CrashpadConfigurerSetURL (const std::string &)
 
CrashpadConfigurerSetArguments (const std::vector< std::string > &arguments)
 
CrashpadConfigurerSetAnnotations (const std::map< std::string, std::string > &annotations)
 
CrashpadConfigurerSetAttachmentsUTF8 (const std::vector< std::string > &attachments)
 
CrashpadConfigurerSetDatabaseUploadEnabled (bool enabled)
 
void Start ()
 

Private Attributes

std::string mHandlerPath
 
std::string mDatabasePath
 
std::string mMetricsDir
 
std::string mURL
 
std::vector< std::string > mArguments
 
std::map< std::string, std::string > mAnnotations
 
std::vector< std::string > mAttachments
 
bool mDatabaseUploadsEnabled { false }
 

Detailed Description

Definition at line 7 of file CrashpadConfigurer.h.

Member Function Documentation

◆ SetAnnotations()

CrashpadConfigurer & CrashpadConfigurer::SetAnnotations ( const std::map< std::string, std::string > &  annotations)

Definition at line 39 of file CrashpadConfigurer.cpp.

40{
41 mAnnotations = annotations;
42 return *this;
43}
std::map< std::string, std::string > mAnnotations

References mAnnotations.

◆ SetArguments()

CrashpadConfigurer & CrashpadConfigurer::SetArguments ( const std::vector< std::string > &  arguments)

Definition at line 33 of file CrashpadConfigurer.cpp.

34{
35 mArguments = arguments;
36 return *this;
37}
std::vector< std::string > mArguments

References mArguments.

Referenced by anonymous_namespace{AudacityApp.cpp}::InitCrashreports().

Here is the caller graph for this function:

◆ SetAttachmentsUTF8()

CrashpadConfigurer & CrashpadConfigurer::SetAttachmentsUTF8 ( const std::vector< std::string > &  attachments)

Definition at line 45 of file CrashpadConfigurer.cpp.

46{
47 mAttachments = attachments;
48 return *this;
49}
std::vector< std::string > mAttachments

References mAttachments.

◆ SetDatabasePathUTF8()

CrashpadConfigurer & CrashpadConfigurer::SetDatabasePathUTF8 ( const std::string &  database)

Definition at line 15 of file CrashpadConfigurer.cpp.

16{
17 mDatabasePath = database;
18 return *this;
19}

References mDatabasePath.

Referenced by anonymous_namespace{AudacityApp.cpp}::InitCrashreports().

Here is the caller graph for this function:

◆ SetDatabaseUploadEnabled()

CrashpadConfigurer & CrashpadConfigurer::SetDatabaseUploadEnabled ( bool  enabled)

Definition at line 51 of file CrashpadConfigurer.cpp.

52{
54 return *this;
55}

References mDatabaseUploadsEnabled.

◆ SetHandlerPathUTF8()

CrashpadConfigurer & CrashpadConfigurer::SetHandlerPathUTF8 ( const std::string &  handlerPath)

Definition at line 9 of file CrashpadConfigurer.cpp.

10{
11 mHandlerPath = handlerPath;
12 return *this;
13}
std::string mHandlerPath

References mHandlerPath.

Referenced by anonymous_namespace{AudacityApp.cpp}::InitCrashreports().

Here is the caller graph for this function:

◆ SetMetricsDirUTF8()

CrashpadConfigurer & CrashpadConfigurer::SetMetricsDirUTF8 ( const std::string &  metricsDir)

Definition at line 21 of file CrashpadConfigurer.cpp.

22{
23 mMetricsDir = metricsDir;
24 return *this;
25}

References mMetricsDir.

Referenced by anonymous_namespace{AudacityApp.cpp}::InitCrashreports().

Here is the caller graph for this function:

◆ SetURL()

CrashpadConfigurer & CrashpadConfigurer::SetURL ( const std::string &  url)

Definition at line 27 of file CrashpadConfigurer.cpp.

28{
29 mURL = url;
30 return *this;
31}

References mURL.

◆ Start()

void CrashpadConfigurer::Start ( )

Definition at line 57 of file CrashpadConfigurer.cpp.

58{
59 base::FilePath databasePath(makeFilePath<base::FilePath::StringType>(mDatabasePath));
60
61 auto database = crashpad::CrashReportDatabase::Initialize(databasePath);
62 if (database == nullptr)
63 {
64 throw std::runtime_error("Crash report database error");
65 }
66 auto dbSettings = database->GetSettings();
67 if (dbSettings == nullptr)
68 {
69 throw std::runtime_error("Cannot access crash report database settings");
70 }
71 dbSettings->SetUploadsEnabled(mDatabaseUploadsEnabled);
72
73 base::FilePath metricsDir(makeFilePath<base::FilePath::StringType>(mMetricsDir));
74 base::FilePath handlerPath(makeFilePath<base::FilePath::StringType>(mHandlerPath));
75 std::vector<base::FilePath> attachments;
76 std::transform(mAttachments.begin(), mAttachments.end(), std::back_inserter(attachments), [](const std::string& path) {
77 return base::FilePath(makeFilePath<base::FilePath::StringType>(path));
78 });
79
80 crashpad::CrashpadClient client;
81
82 auto success = client.StartHandler(
83 handlerPath,
84 databasePath,
85 metricsDir,
86 mURL,
89 true,
90 false,
91 attachments);
92
93 if (!success)
94 {
95 throw std::runtime_error("Cannot start crashpad handler");
96 }
97}
wxString FilePath
Definition: Project.h:21

References Journal::Events::anonymous_namespace{JournalEvents.cpp}::Initialize(), mAnnotations, mArguments, mAttachments, mDatabasePath, mDatabaseUploadsEnabled, mHandlerPath, mMetricsDir, and mURL.

Referenced by anonymous_namespace{AudacityApp.cpp}::InitCrashreports().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mAnnotations

std::map<std::string, std::string> CrashpadConfigurer::mAnnotations
private

Definition at line 14 of file CrashpadConfigurer.h.

Referenced by SetAnnotations(), and Start().

◆ mArguments

std::vector<std::string> CrashpadConfigurer::mArguments
private

Definition at line 13 of file CrashpadConfigurer.h.

Referenced by SetArguments(), and Start().

◆ mAttachments

std::vector<std::string> CrashpadConfigurer::mAttachments
private

Definition at line 15 of file CrashpadConfigurer.h.

Referenced by SetAttachmentsUTF8(), and Start().

◆ mDatabasePath

std::string CrashpadConfigurer::mDatabasePath
private

Definition at line 10 of file CrashpadConfigurer.h.

Referenced by SetDatabasePathUTF8(), and Start().

◆ mDatabaseUploadsEnabled

bool CrashpadConfigurer::mDatabaseUploadsEnabled { false }
private

Definition at line 16 of file CrashpadConfigurer.h.

Referenced by SetDatabaseUploadEnabled(), and Start().

◆ mHandlerPath

std::string CrashpadConfigurer::mHandlerPath
private

Definition at line 9 of file CrashpadConfigurer.h.

Referenced by SetHandlerPathUTF8(), and Start().

◆ mMetricsDir

std::string CrashpadConfigurer::mMetricsDir
private

Definition at line 11 of file CrashpadConfigurer.h.

Referenced by SetMetricsDirUTF8(), and Start().

◆ mURL

std::string CrashpadConfigurer::mURL
private

Definition at line 12 of file CrashpadConfigurer.h.

Referenced by SetURL(), and Start().


The documentation for this class was generated from the following files: