win: Set uploading parameters in crash reporter.
This commit is contained in:
parent
717b664802
commit
70b7659893
3 changed files with 37 additions and 4 deletions
|
@ -53,7 +53,6 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
|
|||
if (waiting_event != INVALID_HANDLE_VALUE)
|
||||
WaitForSingleObject(waiting_event, 1000);
|
||||
|
||||
google_breakpad::CustomClientInfo custom_info = { NULL, 0 };
|
||||
breakpad_.reset(new google_breakpad::ExceptionHandler(
|
||||
temp_dir.value(),
|
||||
FilterCallback,
|
||||
|
@ -62,7 +61,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
|
|||
google_breakpad::ExceptionHandler::HANDLER_ALL,
|
||||
kSmallDumpType,
|
||||
pipe_name.c_str(),
|
||||
&custom_info));
|
||||
GetCustomInfo(product_name, version, company_name)));
|
||||
|
||||
if (!breakpad_->IsOutOfProcess())
|
||||
LOG(ERROR) << "Cannot initialize out-of-process crash handler";
|
||||
|
@ -93,6 +92,30 @@ bool CrashReporterWin::MinidumpCallback(const wchar_t* dump_path,
|
|||
return false;
|
||||
}
|
||||
|
||||
google_breakpad::CustomClientInfo* CrashReporterWin::GetCustomInfo(
|
||||
const std::string& product_name,
|
||||
const std::string& version,
|
||||
const std::string& company_name) {
|
||||
custom_info_entries_.clear();
|
||||
custom_info_entries_.reserve(2 + upload_parameters_.size());
|
||||
|
||||
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
|
||||
L"prod", UTF8ToWide(product_name).c_str()));
|
||||
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
|
||||
L"ver", UTF8ToWide(version).c_str()));
|
||||
|
||||
for (StringMap::const_iterator iter = upload_parameters_.begin();
|
||||
iter != upload_parameters_.end(); ++iter) {
|
||||
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
|
||||
UTF8ToWide(iter->first).c_str(),
|
||||
UTF8ToWide(iter->second).c_str()));
|
||||
}
|
||||
|
||||
custom_info_.entries = &custom_info_entries_.front();
|
||||
custom_info_.count = custom_info_entries_.size();
|
||||
return &custom_info_;
|
||||
}
|
||||
|
||||
// static
|
||||
CrashReporterWin* CrashReporterWin::GetInstance() {
|
||||
return Singleton<CrashReporterWin>::get();
|
||||
|
|
|
@ -43,6 +43,16 @@ class CrashReporterWin : public CrashReporter {
|
|||
MDRawAssertionInfo* assertion,
|
||||
bool succeeded);
|
||||
|
||||
// Returns the custom info structure based on parameters.
|
||||
google_breakpad::CustomClientInfo* GetCustomInfo(
|
||||
const std::string& product_name,
|
||||
const std::string& version,
|
||||
const std::string& company_name);
|
||||
|
||||
// Custom information to be passed to crash handler.
|
||||
std::vector<google_breakpad::CustomInfoEntry> custom_info_entries_;
|
||||
google_breakpad::CustomClientInfo custom_info_;
|
||||
|
||||
bool skip_system_crash_handler_;
|
||||
scoped_ptr<google_breakpad::ExceptionHandler> breakpad_;
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@ describe 'crash-reporter module', ->
|
|||
server = http.createServer (req, res) ->
|
||||
form = new formidable.IncomingForm()
|
||||
form.parse req, (error, fields, files) ->
|
||||
assert.equal fields['prod'], 'atom-shell'
|
||||
assert.equal fields['prod'], 'Atom-Shell'
|
||||
assert.equal fields['ver'], process.versions['atom-shell']
|
||||
assert.equal fields['process_type'], 'renderer'
|
||||
assert.equal fields['platform'], process.platform
|
||||
assert.equal fields['extra1'], 'extra1'
|
||||
assert.equal fields['extra2'], 'extra2'
|
||||
assert.equal files['upload_file_minidump']['name'], 'minidump.dmp'
|
||||
assert files['upload_file_minidump']['name']?
|
||||
|
||||
w.destroy()
|
||||
res.end()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue