diff --git a/atom/common/crash_reporter/crash_reporter_mac.h b/atom/common/crash_reporter/crash_reporter_mac.h index 53202c0f174f..86f216bf5575 100644 --- a/atom/common/crash_reporter/crash_reporter_mac.h +++ b/atom/common/crash_reporter/crash_reporter_mac.h @@ -9,9 +9,16 @@ #include "atom/common/crash_reporter/crash_reporter.h" #include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" +#include "base/strings/string_piece.h" +#include "vendor/crashpad/client/simple_string_dictionary.h" template struct DefaultSingletonTraits; +namespace crashpad { +class CrashReportDatabase; +} + namespace crash_reporter { class CrashReporterMac : public CrashReporter { @@ -32,6 +39,13 @@ class CrashReporterMac : public CrashReporter { CrashReporterMac(); virtual ~CrashReporterMac(); + void SetUploadsEnabled(bool enable_uploads); + void SetCrashKeyValue(const base::StringPiece& key, + const base::StringPiece& value); + + scoped_ptr simple_string_dictionary_; + scoped_ptr crash_report_database_; + DISALLOW_COPY_AND_ASSIGN(CrashReporterMac); }; diff --git a/atom/common/crash_reporter/crash_reporter_mac.mm b/atom/common/crash_reporter/crash_reporter_mac.mm index 0e6635cafbbc..fe55475c051e 100644 --- a/atom/common/crash_reporter/crash_reporter_mac.mm +++ b/atom/common/crash_reporter/crash_reporter_mac.mm @@ -19,25 +19,6 @@ namespace crash_reporter { -namespace { - -crashpad::SimpleStringDictionary* g_simple_string_dictionary; -crashpad::CrashReportDatabase* g_database; - -void SetUploadsEnabled(bool enable_uploads) { - if (g_database) { - crashpad::Settings* settings = g_database->GetSettings(); - settings->SetUploadsEnabled(enable_uploads); - } -} - -void SetCrashKeyValue(const base::StringPiece& key, - const base::StringPiece& value) { - g_simple_string_dictionary->SetKeyValue(key.data(), value.data()); -} - -} // namespace - CrashReporterMac::CrashReporterMac() { } @@ -64,12 +45,10 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name, framework_bundle_path.Append("Resources").Append("crashpad_handler"); crashpad::CrashpadClient crashpad_client; - // Send all crash reports. - std::vector arguments = { "--upload-internal=0" }; if (crashpad_client.StartHandler(handler_path, database_path, submit_url, StringMap(), - arguments)) { + std::vector())) { crashpad_client.UseHandler(); } } // @autoreleasepool @@ -82,8 +61,8 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name, crashpad::TriState::kDisabled); } - g_simple_string_dictionary = new crashpad::SimpleStringDictionary(); - crashpad_info->set_simple_annotations(g_simple_string_dictionary); + simple_string_dictionary_.reset(new crashpad::SimpleStringDictionary()); + crashpad_info->set_simple_annotations(simple_string_dictionary_.get()); SetCrashKeyValue("prod", ATOM_PRODUCT_NAME); SetCrashKeyValue("process_type", is_browser_ ? base::StringPiece("browser") @@ -95,8 +74,8 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name, SetCrashKeyValue(iter->first, iter->second); } if (is_browser_) { - g_database = - crashpad::CrashReportDatabase::Initialize(database_path).release(); + crash_report_database_ = crashpad::CrashReportDatabase::Initialize( + database_path); SetUploadsEnabled(auto_submit); } } @@ -105,6 +84,18 @@ void CrashReporterMac::SetUploadParameters() { upload_parameters_["platform"] = "darwin"; } +void CrashReporterMac::SetUploadsEnabled(bool enable_uploads) { + if (crash_report_database_) { + crashpad::Settings* settings = crash_report_database_->GetSettings(); + settings->SetUploadsEnabled(enable_uploads); + } +} + +void CrashReporterMac::SetCrashKeyValue(const base::StringPiece& key, + const base::StringPiece& value) { + simple_string_dictionary_->SetKeyValue(key.data(), value.data()); +} + // static CrashReporterMac* CrashReporterMac::GetInstance() { return Singleton::get(); diff --git a/common.gypi b/common.gypi index 1bd88828ea77..c6f3320c0a5b 100644 --- a/common.gypi +++ b/common.gypi @@ -30,7 +30,6 @@ 'v8_enable_i18n_support': 'false', # Required by Linux (empty for now, should support it in future). 'sysroot': '', - 'crashpad_standalone': 1, }, # Settings to compile node under Windows. 'target_defaults': {