add new method and mark setExtraParameter for deprecation

This commit is contained in:
Shelley Vohr 2017-11-01 21:57:43 -04:00
parent 33092e6324
commit 3af83f1c97
No known key found for this signature in database
GPG key ID: F13993A75599653C
8 changed files with 72 additions and 25 deletions

View file

@ -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",