Add API to set product name for crash reporter.
This commit is contained in:
parent
e7d25385b0
commit
a6989847ea
5 changed files with 27 additions and 3 deletions
|
@ -14,26 +14,33 @@ namespace atom {
|
||||||
namespace api {
|
namespace api {
|
||||||
|
|
||||||
// static
|
// static
|
||||||
v8::Handle<v8::Value> CrashReporter::SetCompanyName(const v8::Arguments &args) {
|
v8::Handle<v8::Value> CrashReporter::SetProductName(const v8::Arguments& args) {
|
||||||
|
crash_reporter::CrashReporter::SetProductName(FromV8Value(args[0]));
|
||||||
|
return v8::Undefined();
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
v8::Handle<v8::Value> CrashReporter::SetCompanyName(const v8::Arguments& args) {
|
||||||
crash_reporter::CrashReporter::SetCompanyName(FromV8Value(args[0]));
|
crash_reporter::CrashReporter::SetCompanyName(FromV8Value(args[0]));
|
||||||
return v8::Undefined();
|
return v8::Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
v8::Handle<v8::Value> CrashReporter::SetSubmissionURL(
|
v8::Handle<v8::Value> CrashReporter::SetSubmissionURL(
|
||||||
const v8::Arguments &args) {
|
const v8::Arguments& args) {
|
||||||
crash_reporter::CrashReporter::SetSubmissionURL(FromV8Value(args[0]));
|
crash_reporter::CrashReporter::SetSubmissionURL(FromV8Value(args[0]));
|
||||||
return v8::Undefined();
|
return v8::Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
v8::Handle<v8::Value> CrashReporter::SetAutoSubmit(const v8::Arguments &args) {
|
v8::Handle<v8::Value> CrashReporter::SetAutoSubmit(const v8::Arguments& args) {
|
||||||
crash_reporter::CrashReporter::SetAutoSubmit(FromV8Value(args[0]));
|
crash_reporter::CrashReporter::SetAutoSubmit(FromV8Value(args[0]));
|
||||||
return v8::Undefined();
|
return v8::Undefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void CrashReporter::Initialize(v8::Handle<v8::Object> target) {
|
void CrashReporter::Initialize(v8::Handle<v8::Object> target) {
|
||||||
|
node::SetMethod(target, "setProductName", SetProductName);
|
||||||
node::SetMethod(target, "setCompanyName", SetCompanyName);
|
node::SetMethod(target, "setCompanyName", SetCompanyName);
|
||||||
node::SetMethod(target, "setSubmissionUrl", SetSubmissionURL);
|
node::SetMethod(target, "setSubmissionUrl", SetSubmissionURL);
|
||||||
node::SetMethod(target, "setAutoSubmit", SetAutoSubmit);
|
node::SetMethod(target, "setAutoSubmit", SetAutoSubmit);
|
||||||
|
|
|
@ -17,6 +17,7 @@ class CrashReporter {
|
||||||
static void Initialize(v8::Handle<v8::Object> target);
|
static void Initialize(v8::Handle<v8::Object> target);
|
||||||
|
|
||||||
private:
|
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> SetCompanyName(const v8::Arguments &args);
|
||||||
static v8::Handle<v8::Value> SetSubmissionURL(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> SetAutoSubmit(const v8::Arguments &args);
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace crash_reporter {
|
||||||
|
|
||||||
class CrashReporter {
|
class CrashReporter {
|
||||||
public:
|
public:
|
||||||
|
static void SetProductName(const std::string& name);
|
||||||
static void SetCompanyName(const std::string& name);
|
static void SetCompanyName(const std::string& name);
|
||||||
static void SetSubmissionURL(const std::string& url);
|
static void SetSubmissionURL(const std::string& url);
|
||||||
static void SetAutoSubmit(bool yes);
|
static void SetAutoSubmit(bool yes);
|
||||||
|
|
|
@ -77,6 +77,16 @@ ScopedCrashReporter* ScopedCrashReporter::g_scoped_crash_reporter_ = NULL;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
// static
|
||||||
|
void CrashReporter::SetProductName(const std::string& name) {
|
||||||
|
ScopedCrashReporter* reporter = ScopedCrashReporter::Get();
|
||||||
|
if (reporter->is_browser())
|
||||||
|
ScopedCrashReporter::Get()->SetKey(BREAKPAD_PRODUCT_DISPLAY, name);
|
||||||
|
else
|
||||||
|
ScopedCrashReporter::Get()->SetKey(BREAKPAD_PRODUCT_DISPLAY,
|
||||||
|
name + " Renderer");
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void CrashReporter::SetCompanyName(const std::string& name) {
|
void CrashReporter::SetCompanyName(const std::string& name) {
|
||||||
ScopedCrashReporter::Get()->SetKey(BREAKPAD_VENDOR, name);
|
ScopedCrashReporter::Get()->SetKey(BREAKPAD_VENDOR, name);
|
||||||
|
|
|
@ -4,11 +4,16 @@ An example of automatically submitting crash reporters to remote server:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
crashReporter = require('crash-reporter');
|
crashReporter = require('crash-reporter');
|
||||||
|
crashReporter.setProductName('YourName');
|
||||||
crashReporter.setCompanyName('YourCompany');
|
crashReporter.setCompanyName('YourCompany');
|
||||||
crashReporter.setSubmissionUrl('https://your-domain.com/url-to-submit');
|
crashReporter.setSubmissionUrl('https://your-domain.com/url-to-submit');
|
||||||
crashReporter.setAutoSubmit(true);
|
crashReporter.setAutoSubmit(true);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## crashReporter.setProductName(product)
|
||||||
|
|
||||||
|
* `product` String
|
||||||
|
|
||||||
## crashReporter.setCompanyName(company)
|
## crashReporter.setCompanyName(company)
|
||||||
|
|
||||||
* `company` String
|
* `company` String
|
||||||
|
|
Loading…
Reference in a new issue