From: Cheng Zhao Date: Wed, 13 Nov 2013 11:12:13 +0000 (+0800) Subject: Add API to set product name for crash reporter. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6989847eaeea5280e89812552aee3cd37ff4dd2;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Add API to set product name for crash reporter. --- diff --git a/common/api/atom_api_crash_reporter.cc b/common/api/atom_api_crash_reporter.cc index b849f6e..83be95a 100644 --- a/common/api/atom_api_crash_reporter.cc +++ b/common/api/atom_api_crash_reporter.cc @@ -14,26 +14,33 @@ namespace atom { namespace api { // static -v8::Handle CrashReporter::SetCompanyName(const v8::Arguments &args) { +v8::Handle CrashReporter::SetProductName(const v8::Arguments& args) { + crash_reporter::CrashReporter::SetProductName(FromV8Value(args[0])); + return v8::Undefined(); +} + +// static +v8::Handle CrashReporter::SetCompanyName(const v8::Arguments& args) { crash_reporter::CrashReporter::SetCompanyName(FromV8Value(args[0])); return v8::Undefined(); } // static v8::Handle CrashReporter::SetSubmissionURL( - const v8::Arguments &args) { + const v8::Arguments& args) { crash_reporter::CrashReporter::SetSubmissionURL(FromV8Value(args[0])); return v8::Undefined(); } // static -v8::Handle CrashReporter::SetAutoSubmit(const v8::Arguments &args) { +v8::Handle CrashReporter::SetAutoSubmit(const v8::Arguments& args) { crash_reporter::CrashReporter::SetAutoSubmit(FromV8Value(args[0])); return v8::Undefined(); } // static void CrashReporter::Initialize(v8::Handle target) { + node::SetMethod(target, "setProductName", SetProductName); node::SetMethod(target, "setCompanyName", SetCompanyName); node::SetMethod(target, "setSubmissionUrl", SetSubmissionURL); node::SetMethod(target, "setAutoSubmit", SetAutoSubmit); diff --git a/common/api/atom_api_crash_reporter.h b/common/api/atom_api_crash_reporter.h index 95ab0c0..2c8a227 100644 --- a/common/api/atom_api_crash_reporter.h +++ b/common/api/atom_api_crash_reporter.h @@ -17,6 +17,7 @@ class CrashReporter { static void Initialize(v8::Handle target); private: + static v8::Handle SetProductName(const v8::Arguments &args); static v8::Handle SetCompanyName(const v8::Arguments &args); static v8::Handle SetSubmissionURL(const v8::Arguments &args); static v8::Handle SetAutoSubmit(const v8::Arguments &args); diff --git a/common/crash_reporter/crash_reporter.h b/common/crash_reporter/crash_reporter.h index dbb7bb5..b710037 100644 --- a/common/crash_reporter/crash_reporter.h +++ b/common/crash_reporter/crash_reporter.h @@ -13,6 +13,7 @@ namespace crash_reporter { class CrashReporter { public: + static void SetProductName(const std::string& name); static void SetCompanyName(const std::string& name); static void SetSubmissionURL(const std::string& url); static void SetAutoSubmit(bool yes); diff --git a/common/crash_reporter/crash_reporter_mac.mm b/common/crash_reporter/crash_reporter_mac.mm index 7ae2386..f7d6272 100644 --- a/common/crash_reporter/crash_reporter_mac.mm +++ b/common/crash_reporter/crash_reporter_mac.mm @@ -78,6 +78,16 @@ ScopedCrashReporter* ScopedCrashReporter::g_scoped_crash_reporter_ = NULL; } // 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 void CrashReporter::SetCompanyName(const std::string& name) { ScopedCrashReporter::Get()->SetKey(BREAKPAD_VENDOR, name); } diff --git a/docs/api/common/crash-reporter.md b/docs/api/common/crash-reporter.md index b6785fa..17493dd 100644 --- a/docs/api/common/crash-reporter.md +++ b/docs/api/common/crash-reporter.md @@ -4,11 +4,16 @@ An example of automatically submitting crash reporters to remote server: ```javascript crashReporter = require('crash-reporter'); +crashReporter.setProductName('YourName'); crashReporter.setCompanyName('YourCompany'); crashReporter.setSubmissionUrl('https://your-domain.com/url-to-submit'); crashReporter.setAutoSubmit(true); ``` +## crashReporter.setProductName(product) + +* `product` String + ## crashReporter.setCompanyName(company) * `company` String