Take options object in process.crashReporter.start
This commit is contained in:
parent
1f07cf2545
commit
91f8d6092b
5 changed files with 35 additions and 28 deletions
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "atom/common/atom_version.h"
|
#include "atom/common/atom_version.h"
|
||||||
|
@ -157,28 +156,14 @@ void AtomBindings::Log(const base::string16& message) {
|
||||||
std::cout << message << std::flush;
|
std::cout << message << std::flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
void AtomBindings::Crash() {
|
void AtomBindings::Crash() {
|
||||||
static_cast<DummyClass*>(nullptr)->crash = true;
|
static_cast<DummyClass*>(nullptr)->crash = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomBindings::StartCrashReporter(
|
// static
|
||||||
const std::string& product_name,
|
void AtomBindings::StartCrashReporter(const mate::Dictionary& options) {
|
||||||
const std::string& company_name,
|
crash_reporter::CrashReporter::GetInstance()->StartWithOptions(options);
|
||||||
const std::string& submit_url,
|
|
||||||
const std::string& tmp_path,
|
|
||||||
const std::map<std::string, std::string>& extra_parameters) {
|
|
||||||
auto all_parameters = extra_parameters;
|
|
||||||
all_parameters["_productName"] = product_name;
|
|
||||||
all_parameters["_companyName"] = company_name;
|
|
||||||
|
|
||||||
auto reporter = crash_reporter::CrashReporter::GetInstance();
|
|
||||||
reporter->Start(product_name,
|
|
||||||
company_name,
|
|
||||||
submit_url,
|
|
||||||
base::FilePath(tmp_path),
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
all_parameters);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -6,11 +6,10 @@
|
||||||
#define ATOM_COMMON_API_ATOM_BINDINGS_H_
|
#define ATOM_COMMON_API_ATOM_BINDINGS_H_
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
|
#include "native_mate/dictionary.h"
|
||||||
#include "v8/include/v8.h"
|
#include "v8/include/v8.h"
|
||||||
#include "vendor/node/deps/uv/include/uv.h"
|
#include "vendor/node/deps/uv/include/uv.h"
|
||||||
|
|
||||||
|
@ -31,12 +30,7 @@ class AtomBindings {
|
||||||
|
|
||||||
static void Log(const base::string16& message);
|
static void Log(const base::string16& message);
|
||||||
static void Crash();
|
static void Crash();
|
||||||
static void StartCrashReporter(
|
static void StartCrashReporter(const mate::Dictionary& options);
|
||||||
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:
|
private:
|
||||||
void ActivateUVLoop(v8::Isolate* isolate);
|
void ActivateUVLoop(v8::Isolate* isolate);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
#include "atom/common/atom_version.h"
|
#include "atom/common/atom_version.h"
|
||||||
|
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
|
@ -22,6 +23,25 @@ CrashReporter::CrashReporter() {
|
||||||
CrashReporter::~CrashReporter() {
|
CrashReporter::~CrashReporter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CrashReporter::StartWithOptions(const mate::Dictionary& options) {
|
||||||
|
std::string product_name;
|
||||||
|
options.Get("productName", &product_name);
|
||||||
|
std::string company_name;
|
||||||
|
options.Get("companyName", &company_name);
|
||||||
|
std::string submit_url;
|
||||||
|
options.Get("submitURL", &submit_url);
|
||||||
|
base::FilePath crashes_dir;
|
||||||
|
options.Get("crashesDirectory", &crashes_dir);
|
||||||
|
StringMap extra_parameters;
|
||||||
|
options.Get("extra", &extra_parameters);
|
||||||
|
|
||||||
|
extra_parameters["_productName"] = product_name;
|
||||||
|
extra_parameters["_companyName"] = company_name;
|
||||||
|
|
||||||
|
Start(product_name, company_name, submit_url, crashes_dir, true, false,
|
||||||
|
extra_parameters);
|
||||||
|
}
|
||||||
|
|
||||||
void CrashReporter::Start(const std::string& product_name,
|
void CrashReporter::Start(const std::string& product_name,
|
||||||
const std::string& company_name,
|
const std::string& company_name,
|
||||||
const std::string& submit_url,
|
const std::string& submit_url,
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
|
#include "native_mate/dictionary.h"
|
||||||
|
|
||||||
namespace crash_reporter {
|
namespace crash_reporter {
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ class CrashReporter {
|
||||||
bool upload_to_server,
|
bool upload_to_server,
|
||||||
bool skip_system_crash_handler,
|
bool skip_system_crash_handler,
|
||||||
const StringMap& extra_parameters);
|
const StringMap& extra_parameters);
|
||||||
|
void StartWithOptions(const mate::Dictionary& options);
|
||||||
|
|
||||||
virtual std::vector<CrashReporter::UploadReportResult> GetUploadedReports(
|
virtual std::vector<CrashReporter::UploadReportResult> GetUploadedReports(
|
||||||
const base::FilePath& crashes_dir);
|
const base::FilePath& crashes_dir);
|
||||||
|
|
|
@ -5,8 +5,14 @@ let productName = 'Child Product';
|
||||||
let companyName = 'Child Company';
|
let companyName = 'Child Company';
|
||||||
let tmpPath = path.join(os.tmpdir(), productName + ' Crashes');
|
let tmpPath = path.join(os.tmpdir(), productName + ' Crashes');
|
||||||
|
|
||||||
process.crashReporter.start(productName, companyName, 'http://localhost:8080/uploadDump/childDump', tmpPath, {
|
process.crashReporter.start({
|
||||||
|
productName: productName,
|
||||||
|
companyName: companyName,
|
||||||
|
submitURL: 'http://localhost:1127/post',
|
||||||
|
crashesDirectory: tmpPath,
|
||||||
|
extra: {
|
||||||
randomData1: 'The Holidays are here!',
|
randomData1: 'The Holidays are here!',
|
||||||
randomData2: 'Happy New Year!'
|
randomData2: 'Happy New Year!'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
process.crash();
|
process.crash();
|
||||||
|
|
Loading…
Reference in a new issue