f98454e5dd
* Initial changes to use crashpad for windows * Remove crashpad patch * Report error when failed to connect pipe * Allow crashpad to communicate with named pipe * Add patch to make crashpad named pipe work * Windows also needs crashReporter on main process * Call SetUnhandledExceptionFilter in node process Node can also use crash reporter. * Do not treat node process as browser process * No more need to manually start crash service * Use base::StringPrintf for better readbility * Print error when pipe name not available * Make sure pipe name is updated Note that the crashpad may be started after renderer process gets created. * Fix some tests * Update node * Exclude crashpad files on Linux and MAS * Fix lint warning * Remove unused checks * kCrashpadPipeName is only available on Windows * Fix uploadToServer tests * Fix extra params tests * Fix getCrashesDirectory tests * Run crashReporter tests on CI * Style fixes * Update crashreporter docs * Rename InitBreakpad to Init * Add comment for process_type_.empty() and UTF16ToASCII to UTF16ToUTF8. * Update build.gn include crashpad headers * Address comment https://github.com/electron/electron/pull/18483#discussion_r290887898 * Avoid using api::WebContents * Put kRunAsNode in atom_constants * Remove duplicate settings on upload params * Fix building on macOS * Update description for crashpad_pid_check.patch
73 lines
2.2 KiB
C++
73 lines
2.2 KiB
C++
// Copyright (c) 2013 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_H_
|
|
#define ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_H_
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
#include "base/files/file_path.h"
|
|
#include "base/macros.h"
|
|
#include "native_mate/dictionary.h"
|
|
|
|
namespace crash_reporter {
|
|
|
|
extern const char kCrashpadProcess[];
|
|
extern const char kCrashesDirectoryKey[];
|
|
|
|
class CrashReporter {
|
|
public:
|
|
typedef std::map<std::string, std::string> StringMap;
|
|
typedef std::pair<int, std::string> UploadReportResult; // upload-date, id
|
|
|
|
static CrashReporter* GetInstance();
|
|
static void StartInstance(const mate::Dictionary& options);
|
|
|
|
bool IsInitialized();
|
|
void Start(const std::string& product_name,
|
|
const std::string& company_name,
|
|
const std::string& submit_url,
|
|
const base::FilePath& crashes_dir,
|
|
bool upload_to_server,
|
|
bool skip_system_crash_handler,
|
|
const StringMap& extra_parameters);
|
|
|
|
virtual std::vector<CrashReporter::UploadReportResult> GetUploadedReports(
|
|
const base::FilePath& crashes_dir);
|
|
|
|
virtual void SetUploadToServer(bool upload_to_server);
|
|
virtual bool GetUploadToServer();
|
|
virtual void AddExtraParameter(const std::string& key,
|
|
const std::string& value);
|
|
virtual void RemoveExtraParameter(const std::string& key);
|
|
virtual std::map<std::string, std::string> GetParameters() const;
|
|
|
|
protected:
|
|
CrashReporter();
|
|
virtual ~CrashReporter();
|
|
|
|
virtual void Init(const std::string& product_name,
|
|
const std::string& company_name,
|
|
const std::string& submit_url,
|
|
const base::FilePath& crashes_dir,
|
|
bool upload_to_server,
|
|
bool skip_system_crash_handler);
|
|
virtual void SetUploadParameters();
|
|
|
|
StringMap upload_parameters_;
|
|
std::string process_type_;
|
|
|
|
private:
|
|
bool is_initialized_ = false;
|
|
void SetUploadParameters(const StringMap& parameters);
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CrashReporter);
|
|
};
|
|
|
|
} // namespace crash_reporter
|
|
|
|
#endif // ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_H_
|