Add crashReporter property to process
This commit is contained in:
parent
d4b44d8b69
commit
1f07cf2545
4 changed files with 22 additions and 19 deletions
|
@ -62,9 +62,13 @@ int NodeMain(int argc, char *argv[]) {
|
|||
#if defined(OS_WIN)
|
||||
process.SetMethod("log", &AtomBindings::Log);
|
||||
#endif
|
||||
process.SetMethod("startCrashReporter", &AtomBindings::StartCrashReporter);
|
||||
process.SetMethod("crash", &AtomBindings::Crash);
|
||||
|
||||
v8::Local<v8::Object> crashReporterObj = v8::Object::New(env->isolate());
|
||||
mate::Dictionary crashReporterDict(gin_env.isolate(), crashReporterObj);
|
||||
crashReporterDict.SetMethod("start", &AtomBindings::StartCrashReporter);
|
||||
process.Set("crashReporter", crashReporterObj);
|
||||
|
||||
node::LoadEnvironment(env);
|
||||
|
||||
bool more;
|
||||
|
|
|
@ -162,24 +162,23 @@ void AtomBindings::Crash() {
|
|||
}
|
||||
|
||||
void AtomBindings::StartCrashReporter(
|
||||
const std::string& productName,
|
||||
const std::string& companyName,
|
||||
const std::string& submitUrl,
|
||||
const std::string& tmpPath,
|
||||
const std::string& product_name,
|
||||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const std::string& tmp_path,
|
||||
const std::map<std::string, std::string>& extra_parameters) {
|
||||
std::map<std::string, std::string> allParameters;
|
||||
allParameters.insert(std::make_pair("_productName", productName));
|
||||
allParameters.insert(std::make_pair("_companyName", companyName));
|
||||
allParameters.insert(extra_parameters.begin(), extra_parameters.end());
|
||||
auto all_parameters = extra_parameters;
|
||||
all_parameters["_productName"] = product_name;
|
||||
all_parameters["_companyName"] = company_name;
|
||||
|
||||
auto reporter = crash_reporter::CrashReporter::GetInstance();
|
||||
reporter->Start(productName,
|
||||
companyName,
|
||||
submitUrl,
|
||||
base::FilePath(tmpPath),
|
||||
reporter->Start(product_name,
|
||||
company_name,
|
||||
submit_url,
|
||||
base::FilePath(tmp_path),
|
||||
true,
|
||||
false,
|
||||
allParameters);
|
||||
all_parameters);
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -32,10 +32,10 @@ class AtomBindings {
|
|||
static void Log(const base::string16& message);
|
||||
static void Crash();
|
||||
static void StartCrashReporter(
|
||||
const std::string& productName,
|
||||
const std::string& companyName,
|
||||
const std::string& submitUrl,
|
||||
const std::string& tmpPath,
|
||||
const std::string& product_name,
|
||||
const std::string& company_name,
|
||||
const std::string& submit_url,
|
||||
const std::string& tmp_path,
|
||||
const std::map<std::string, std::string>& extra_parameters);
|
||||
|
||||
private:
|
||||
|
|
|
@ -5,7 +5,7 @@ let productName = 'Child Product';
|
|||
let companyName = 'Child Company';
|
||||
let tmpPath = path.join(os.tmpdir(), productName + ' Crashes');
|
||||
|
||||
process.startCrashReporter(productName, companyName, 'http://localhost:8080/uploadDump/childDump', tmpPath, {
|
||||
process.crashReporter.start(productName, companyName, 'http://localhost:8080/uploadDump/childDump', tmpPath, {
|
||||
randomData1: 'The Holidays are here!',
|
||||
randomData2: 'Happy New Year!'
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue