chore: convert View APIs away from base::Bind (#18035)

This commit is contained in:
Shelley Vohr 2019-04-29 17:40:39 -07:00 committed by Cheng Zhao
parent 4a3771ff7f
commit 4ee201c56e
14 changed files with 40 additions and 32 deletions

View file

@ -52,16 +52,19 @@ void Initialize(v8::Local<v8::Object> exports,
void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
auto reporter = base::Unretained(CrashReporter::GetInstance());
dict.SetMethod("start", base::Bind(&CrashReporter::Start, reporter));
dict.SetMethod("start", base::BindRepeating(&CrashReporter::Start, reporter));
dict.SetMethod("addExtraParameter", &AddExtraParameter);
dict.SetMethod("removeExtraParameter", &RemoveExtraParameter);
dict.SetMethod("getParameters", &GetParameters);
dict.SetMethod("getUploadedReports",
base::Bind(&CrashReporter::GetUploadedReports, reporter));
dict.SetMethod("setUploadToServer",
base::Bind(&CrashReporter::SetUploadToServer, reporter));
dict.SetMethod("getUploadToServer",
base::Bind(&CrashReporter::GetUploadToServer, reporter));
dict.SetMethod(
"getUploadedReports",
base::BindRepeating(&CrashReporter::GetUploadedReports, reporter));
dict.SetMethod(
"setUploadToServer",
base::BindRepeating(&CrashReporter::SetUploadToServer, reporter));
dict.SetMethod(
"getUploadToServer",
base::BindRepeating(&CrashReporter::GetUploadToServer, reporter));
}
} // namespace

View file

@ -73,8 +73,9 @@ void ElectronBindings::BindProcess(v8::Isolate* isolate,
process->SetMethod("getSystemVersion",
&base::SysInfo::OperatingSystemVersion);
process->SetMethod("getIOCounters", &GetIOCounters);
process->SetMethod("getCPUUsage", base::Bind(&ElectronBindings::GetCPUUsage,
base::Unretained(metrics)));
process->SetMethod("getCPUUsage",
base::BindRepeating(&ElectronBindings::GetCPUUsage,
base::Unretained(metrics)));
#if defined(MAS_BUILD)
process->SetReadOnly("mas", true);
@ -97,8 +98,9 @@ void ElectronBindings::BindTo(v8::Isolate* isolate,
#if defined(OS_POSIX)
dict.SetMethod("setFdLimit", &base::IncreaseFdLimitTo);
#endif
dict.SetMethod("activateUvLoop", base::Bind(&ElectronBindings::ActivateUVLoop,
base::Unretained(this)));
dict.SetMethod("activateUvLoop",
base::BindRepeating(&ElectronBindings::ActivateUVLoop,
base::Unretained(this)));
mate::Dictionary versions;
if (dict.Get("versions", &versions)) {