fix: Expose missing Add/RemoveExtraParameter methods to macOS node child processes (#15790)

* Expose missing crash reporter methods in mac node processes

* Crashpad migration
This commit is contained in:
foo bar code 2019-07-29 02:46:35 +02:00 committed by Cheng Zhao
parent c9a455ea49
commit 4e0e615406
3 changed files with 69 additions and 5 deletions

View file

@ -5,6 +5,7 @@
#include "shell/app/node_main.h"
#include <memory>
#include <string>
#include <utility>
#include "base/command_line.h"
@ -31,6 +32,16 @@
namespace electron {
#if !defined(OS_LINUX)
void AddExtraParameter(const std::string& key, const std::string& value) {
crash_reporter::CrashReporter::GetInstance()->AddExtraParameter(key, value);
}
void RemoveExtraParameter(const std::string& key) {
crash_reporter::CrashReporter::GetInstance()->RemoveExtraParameter(key);
}
#endif
int NodeMain(int argc, char* argv[]) {
base::CommandLine::Init(argc, argv);
@ -87,6 +98,12 @@ int NodeMain(int argc, char* argv[]) {
// Setup process.crashReporter.start in child node processes
auto reporter = mate::Dictionary::CreateEmpty(gin_env.isolate());
reporter.SetMethod("start", &crash_reporter::CrashReporter::StartInstance);
#if !defined(OS_LINUX)
reporter.SetMethod("addExtraParameter", &AddExtraParameter);
reporter.SetMethod("removeExtraParameter", &RemoveExtraParameter);
#endif
process.Set("crashReporter", reporter);
mate::Dictionary versions;