Refactor crash reporter to be more cross-platform friendly.
This commit is contained in:
parent
801a19504a
commit
9007a45051
8 changed files with 171 additions and 113 deletions
|
@ -14,36 +14,22 @@ namespace atom {
|
|||
namespace api {
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> CrashReporter::SetProductName(const v8::Arguments& args) {
|
||||
crash_reporter::CrashReporter::SetProductName(FromV8Value(args[0]));
|
||||
return v8::Undefined();
|
||||
}
|
||||
v8::Handle<v8::Value> CrashReporter::Start(const v8::Arguments& args) {
|
||||
std::string product_name, company_name, submit_url;
|
||||
bool auto_submit, skip_system;
|
||||
if (!FromV8Arguments(args, &product_name, &company_name, &submit_url,
|
||||
&auto_submit, &skip_system))
|
||||
return node::ThrowTypeError("Bad argument");
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> CrashReporter::SetCompanyName(const v8::Arguments& args) {
|
||||
crash_reporter::CrashReporter::SetCompanyName(FromV8Value(args[0]));
|
||||
return v8::Undefined();
|
||||
}
|
||||
crash_reporter::CrashReporter::GetInstance()->Start(
|
||||
product_name, company_name, submit_url, auto_submit, skip_system);
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> CrashReporter::SetSubmissionURL(
|
||||
const v8::Arguments& args) {
|
||||
crash_reporter::CrashReporter::SetSubmissionURL(FromV8Value(args[0]));
|
||||
return v8::Undefined();
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> CrashReporter::SetAutoSubmit(const v8::Arguments& args) {
|
||||
crash_reporter::CrashReporter::SetAutoSubmit(FromV8Value(args[0]));
|
||||
return v8::Undefined();
|
||||
}
|
||||
|
||||
// static
|
||||
void CrashReporter::Initialize(v8::Handle<v8::Object> target) {
|
||||
node::SetMethod(target, "setProductName", SetProductName);
|
||||
node::SetMethod(target, "setCompanyName", SetCompanyName);
|
||||
node::SetMethod(target, "setSubmissionUrl", SetSubmissionURL);
|
||||
node::SetMethod(target, "setAutoSubmit", SetAutoSubmit);
|
||||
node::SetMethod(target, "start", Start);
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
|
|
@ -17,10 +17,7 @@ class CrashReporter {
|
|||
static void Initialize(v8::Handle<v8::Object> target);
|
||||
|
||||
private:
|
||||
static v8::Handle<v8::Value> SetProductName(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> SetCompanyName(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> SetSubmissionURL(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> SetAutoSubmit(const v8::Arguments &args);
|
||||
static v8::Handle<v8::Value> Start(const v8::Arguments& args);
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(CrashReporter);
|
||||
};
|
||||
|
|
|
@ -1 +1,15 @@
|
|||
module.exports = process.atomBinding 'crash_reporter'
|
||||
binding = process.atomBinding 'crash_reporter'
|
||||
|
||||
class CrashReporter
|
||||
start: (options) ->
|
||||
{productName, companyName, submitUrl, autoSubmit, ignoreSystemCrashHandler} = options
|
||||
|
||||
productName ?= 'Atom-Shell'
|
||||
companyName ?= 'GitHub, Inc'
|
||||
submitUrl ?= 'http://54.249.141.25'
|
||||
autoSubmit ?= true
|
||||
ignoreSystemCrashHandler ?= false
|
||||
|
||||
binding.start productName, companyName, submitUrl, autoSubmit, ignoreSystemCrashHandler
|
||||
|
||||
module.exports = new CrashReporter
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue