Add extra uploading parameters for crash reporter.

This commit is contained in:
Cheng Zhao 2013-11-14 18:02:15 +08:00
parent d1a5c49843
commit 6b02be6da8
6 changed files with 32 additions and 3 deletions

View file

@ -12,9 +12,9 @@
namespace crash_reporter { namespace crash_reporter {
CrashReporter::CrashReporter() { CrashReporter::CrashReporter() {
const CommandLine& command = *CommandLine::ForCurrentProcess(); SetUploadParameters();
std::string type = command.GetSwitchValueASCII(switches::kProcessType);
is_browser_ = type.empty(); is_browser_ = upload_parameters_["process_type"].empty();
} }
CrashReporter::~CrashReporter() { CrashReporter::~CrashReporter() {
@ -42,4 +42,12 @@ void CrashReporter::Start(std::string product_name,
skip_system_crash_handler); skip_system_crash_handler);
} }
void CrashReporter::SetUploadParameters() {
const CommandLine& command = *CommandLine::ForCurrentProcess();
std::string type = command.GetSwitchValueASCII(switches::kProcessType);
upload_parameters_["process_type"] = type;
upload_parameters_["atom_shell_version"] = ATOM_VERSION_STRING;
}
} // namespace crash_reporter } // namespace crash_reporter

View file

@ -5,6 +5,7 @@
#ifndef ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_H_ #ifndef ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_H_
#define ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_H_ #define ATOM_COMMON_CRASH_REPORTER_CRASH_REPORTER_H_
#include <map>
#include <string> #include <string>
#include "base/basictypes.h" #include "base/basictypes.h"
@ -31,7 +32,10 @@ class CrashReporter {
const std::string& submit_url, const std::string& submit_url,
bool auto_submit, bool auto_submit,
bool skip_system_crash_handler) = 0; bool skip_system_crash_handler) = 0;
virtual void SetUploadParameters();
typedef std::map<std::string, std::string> StringMap;
StringMap upload_parameters_;
bool is_browser_; bool is_browser_;
private: private:

View file

@ -23,6 +23,7 @@ class CrashReporterMac : public CrashReporter {
const std::string& submit_url, const std::string& submit_url,
bool auto_submit, bool auto_submit,
bool skip_system_crash_handler) OVERRIDE; bool skip_system_crash_handler) OVERRIDE;
virtual void SetUploadParameters() OVERRIDE;
private: private:
friend struct DefaultSingletonTraits<CrashReporterMac>; friend struct DefaultSingletonTraits<CrashReporterMac>;

View file

@ -48,6 +48,17 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
[parameters setValue:@"0" forKey:@BREAKPAD_REPORT_INTERVAL]; [parameters setValue:@"0" forKey:@BREAKPAD_REPORT_INTERVAL];
breakpad_ = BreakpadCreate(parameters); breakpad_ = BreakpadCreate(parameters);
for (StringMap::const_iterator iter = upload_parameters_.begin();
iter != upload_parameters_.end(); ++iter) {
BreakpadAddUploadParameter(breakpad_,
base::SysUTF8ToNSString(iter->first),
base::SysUTF8ToNSString(iter->second));
}
}
void CrashReporterMac::SetUploadParameters() {
upload_parameters_["platform"] = "darwin";
} }
// static // static

View file

@ -25,6 +25,10 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
bool skip_system_crash_handler) { bool skip_system_crash_handler) {
} }
void CrashReporterWin::SetUploadParameters() {
upload_parameters_["platform"] = "win32";
}
// static // static
CrashReporterWin* CrashReporterWin::GetInstance() { CrashReporterWin* CrashReporterWin::GetInstance() {
return Singleton<CrashReporterWin>::get(); return Singleton<CrashReporterWin>::get();

View file

@ -22,6 +22,7 @@ class CrashReporterWin : public CrashReporter {
const std::string& submit_url, const std::string& submit_url,
bool auto_submit, bool auto_submit,
bool skip_system_crash_handler) OVERRIDE; bool skip_system_crash_handler) OVERRIDE;
virtual void SetUploadParameters() OVERRIDE;
private: private:
friend struct DefaultSingletonTraits<CrashReporterWin>; friend struct DefaultSingletonTraits<CrashReporterWin>;