Pass uploadToServer to windows crash reporter

This commit is contained in:
Thiago de Arruda 2017-03-29 09:16:27 -03:00
parent 96407d9c17
commit f0d447cd68
4 changed files with 12 additions and 6 deletions

View file

@ -179,7 +179,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
google_breakpad::ExceptionHandler::HANDLER_ALL, google_breakpad::ExceptionHandler::HANDLER_ALL,
kSmallDumpType, kSmallDumpType,
pipe_name.c_str(), pipe_name.c_str(),
GetCustomInfo(product_name, version, company_name))); GetCustomInfo(product_name, version, company_name, upload_to_server)));
if (!breakpad_->IsOutOfProcess()) if (!breakpad_->IsOutOfProcess())
LOG(ERROR) << "Cannot initialize out-of-process crash handler"; LOG(ERROR) << "Cannot initialize out-of-process crash handler";
@ -238,14 +238,19 @@ bool CrashReporterWin::MinidumpCallback(const wchar_t* dump_path,
google_breakpad::CustomClientInfo* CrashReporterWin::GetCustomInfo( google_breakpad::CustomClientInfo* CrashReporterWin::GetCustomInfo(
const std::string& product_name, const std::string& product_name,
const std::string& version, const std::string& version,
const std::string& company_name) { const std::string& company_name,
bool upload_to_server) {
custom_info_entries_.clear(); custom_info_entries_.clear();
custom_info_entries_.reserve(2 + upload_parameters_.size()); custom_info_entries_.reserve(3 + upload_parameters_.size());
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry( custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"prod", L"Electron")); L"prod", L"Electron"));
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry( custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"ver", base::UTF8ToWide(version).c_str())); L"ver", base::UTF8ToWide(version).c_str()));
if (!upload_to_server) {
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"skip_upload", L"1"));
}
for (StringMap::const_iterator iter = upload_parameters_.begin(); for (StringMap::const_iterator iter = upload_parameters_.begin();
iter != upload_parameters_.end(); ++iter) { iter != upload_parameters_.end(); ++iter) {

View file

@ -56,7 +56,8 @@ class CrashReporterWin : public CrashReporter {
google_breakpad::CustomClientInfo* GetCustomInfo( google_breakpad::CustomClientInfo* GetCustomInfo(
const std::string& product_name, const std::string& product_name,
const std::string& version, const std::string& version,
const std::string& company_name); const std::string& company_name,
bool upload_to_server);
// Custom information to be passed to crash handler. // Custom information to be passed to crash handler.
std::vector<google_breakpad::CustomInfoEntry> custom_info_entries_; std::vector<google_breakpad::CustomInfoEntry> custom_info_entries_;

View file

@ -391,7 +391,7 @@ void CrashService::OnClientDumpRequest(void* context,
LOG(ERROR) << "could not write custom info file"; LOG(ERROR) << "could not write custom info file";
} }
if (!self->sender_) if (!self->sender_ || map.find(L"skip_upload") != map.end())
return; return;
// Send the crash dump using a worker thread. This operation has retry // Send the crash dump using a worker thread. This operation has retry

View file

@ -40,7 +40,7 @@ The `crashReporter` module has the following methods:
* `companyName` String (optional) * `companyName` String (optional)
* `submitURL` String - URL that crash reports will be sent to as POST. * `submitURL` String - URL that crash reports will be sent to as POST.
* `productName` String (optional) - Defaults to `app.getName()`. * `productName` String (optional) - Defaults to `app.getName()`.
* `uploadToServer` Boolean (optional) _Linux_ _macOS_ - Whether crash reports should be sent to the server * `uploadToServer` Boolean (optional) - Whether crash reports should be sent to the server
Default is `true`. Default is `true`.
* `ignoreSystemCrashHandler` Boolean (optional) - Default is `false`. * `ignoreSystemCrashHandler` Boolean (optional) - Default is `false`.
* `extra` Object (optional) - An object you can define that will be sent along with the * `extra` Object (optional) - An object you can define that will be sent along with the