add new method and mark setExtraParameter for deprecation
This commit is contained in:
parent
33092e6324
commit
3af83f1c97
8 changed files with 72 additions and 25 deletions
|
@ -31,8 +31,17 @@ struct Converter<CrashReporter::UploadReportResult> {
|
|||
|
||||
namespace {
|
||||
|
||||
void SetExtraParameter(const std::string& key, const std::string& value) {
|
||||
CrashReporter::GetInstance()->SetExtraParameter(key, value);
|
||||
// TODO(2.0) Deprecate
|
||||
void SetExtraParameter(const std::string& key, mate::Arguments* args) {
|
||||
std::string value;
|
||||
if (args->GetNext(&value))
|
||||
CrashReporter::GetInstance()->AddExtraParameter(key, value);
|
||||
else
|
||||
CrashReporter::GetInstance()->RemoveExtraParameter(key);
|
||||
}
|
||||
|
||||
void AddExtraParameter(const std::string& key, const std::string& value) {
|
||||
CrashReporter::GetInstance()->AddExtraParameter(key, value);
|
||||
}
|
||||
|
||||
void RemoveExtraParameter(const std::string& key) {
|
||||
|
@ -49,6 +58,7 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
auto reporter = base::Unretained(CrashReporter::GetInstance());
|
||||
dict.SetMethod("start", base::Bind(&CrashReporter::Start, reporter));
|
||||
dict.SetMethod("setExtraParameter", &SetExtraParameter);
|
||||
dict.SetMethod("addExtraParameter", &AddExtraParameter);
|
||||
dict.SetMethod("removeExtraParameter", &RemoveExtraParameter);
|
||||
dict.SetMethod("getParameters", &GetParameters);
|
||||
dict.SetMethod("getUploadedReports",
|
||||
|
|
|
@ -86,7 +86,7 @@ void CrashReporter::InitBreakpad(const std::string& product_name,
|
|||
void CrashReporter::SetUploadParameters() {
|
||||
}
|
||||
|
||||
void CrashReporter::SetExtraParameter(const std::string& key,
|
||||
void CrashReporter::AddExtraParameter(const std::string& key,
|
||||
const std::string& value) {
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class CrashReporter {
|
|||
|
||||
virtual void SetUploadToServer(bool upload_to_server);
|
||||
virtual bool GetUploadToServer();
|
||||
virtual void SetExtraParameter(const std::string& key,
|
||||
virtual void AddExtraParameter(const std::string& key,
|
||||
const std::string& value);
|
||||
virtual void RemoveExtraParameter(const std::string& key);
|
||||
virtual std::map<std::string, std::string> GetParameters() const;
|
||||
|
|
|
@ -35,7 +35,7 @@ class CrashReporterMac : public CrashReporter {
|
|||
void SetUploadParameters() override;
|
||||
void SetUploadToServer(bool upload_to_server) override;
|
||||
bool GetUploadToServer() override;
|
||||
void SetExtraParameter(const std::string& key,
|
||||
void AddExtraParameter(const std::string& key,
|
||||
const std::string& value) override;
|
||||
void RemoveExtraParameter(const std::string& key) override;
|
||||
std::map<std::string, std::string> GetParameters() const override;
|
||||
|
|
|
@ -105,7 +105,7 @@ void CrashReporterMac::SetCrashKeyValue(const base::StringPiece& key,
|
|||
simple_string_dictionary_->SetKeyValue(key.data(), value.data());
|
||||
}
|
||||
|
||||
void CrashReporterMac::SetExtraParameter(const std::string& key,
|
||||
void CrashReporterMac::AddExtraParameter(const std::string& key,
|
||||
const std::string& value) {
|
||||
if (simple_string_dictionary_) {
|
||||
SetCrashKeyValue(key, value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue