From 4ee201c56e22f0319b8c1700efaaa10804f095db Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 29 Apr 2019 17:40:39 -0700 Subject: [PATCH] chore: convert View APIs away from base::Bind (#18035) --- atom/browser/api/atom_api_app.cc | 2 +- atom/browser/api/atom_api_net_log.cc | 2 +- atom/browser/api/atom_api_power_monitor.cc | 8 ++++---- atom/browser/api/atom_api_web_contents_view.cc | 5 +++-- atom/browser/api/views/atom_api_box_layout.cc | 2 +- atom/browser/api/views/atom_api_button.cc | 4 ++-- atom/browser/api/views/atom_api_label_button.cc | 2 +- .../api/views/atom_api_layout_manager.cc | 5 +++-- .../api/views/atom_api_md_text_button.cc | 5 +++-- atom/browser/api/views/atom_api_resize_area.cc | 2 +- atom/browser/api/views/atom_api_text_field.cc | 2 +- atom/common/api/atom_api_crash_reporter.cc | 17 ++++++++++------- atom/common/api/electron_bindings.cc | 10 ++++++---- atom/renderer/renderer_client_base.cc | 6 +++--- 14 files changed, 40 insertions(+), 32 deletions(-) diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 84cd904023a4..c7b8cc98da6b 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -1353,7 +1353,7 @@ void App::BuildPrototype(v8::Isolate* isolate, .SetMethod("clearRecentDocuments", base::BindRepeating(&Browser::ClearRecentDocuments, browser)) .SetMethod("setAppUserModelId", - base::Bind(&Browser::SetAppUserModelID, browser)) + base::BindRepeating(&Browser::SetAppUserModelID, browser)) .SetMethod( "isDefaultProtocolClient", base::BindRepeating(&Browser::IsDefaultProtocolClient, browser)) diff --git a/atom/browser/api/atom_api_net_log.cc b/atom/browser/api/atom_api_net_log.cc index 3c1aea105145..88e3044c9194 100644 --- a/atom/browser/api/atom_api_net_log.cc +++ b/atom/browser/api/atom_api_net_log.cc @@ -110,7 +110,7 @@ void NetLog::OnNewState(const base::DictionaryValue& state) { for (auto& promise : stop_callback_queue_) { // TODO(zcbenz): Remove the use of CopyablePromise when the // GetFilePathToCompletedLog API accepts OnceCallback. - net_log_writer_->GetFilePathToCompletedLog(base::Bind( + net_log_writer_->GetFilePathToCompletedLog(base::BindRepeating( util::CopyablePromise::ResolveCopyablePromise, util::CopyablePromise(promise))); } diff --git a/atom/browser/api/atom_api_power_monitor.cc b/atom/browser/api/atom_api_power_monitor.cc index c9b207feeb33..9880d55be99b 100644 --- a/atom/browser/api/atom_api_power_monitor.cc +++ b/atom/browser/api/atom_api_power_monitor.cc @@ -37,11 +37,11 @@ namespace api { PowerMonitor::PowerMonitor(v8::Isolate* isolate) { #if defined(OS_LINUX) - SetShutdownHandler( - base::Bind(&PowerMonitor::ShouldShutdown, base::Unretained(this))); + SetShutdownHandler(base::BindRepeating(&PowerMonitor::ShouldShutdown, + base::Unretained(this))); #elif defined(OS_MACOSX) - Browser::Get()->SetShutdownHandler( - base::Bind(&PowerMonitor::ShouldShutdown, base::Unretained(this))); + Browser::Get()->SetShutdownHandler(base::BindRepeating( + &PowerMonitor::ShouldShutdown, base::Unretained(this))); #endif base::PowerMonitor::Get()->AddObserver(this); Init(isolate); diff --git a/atom/browser/api/atom_api_web_contents_view.cc b/atom/browser/api/atom_api_web_contents_view.cc index fb3e027c9f64..51a902defab8 100644 --- a/atom/browser/api/atom_api_web_contents_view.cc +++ b/atom/browser/api/atom_api_web_contents_view.cc @@ -124,8 +124,9 @@ void Initialize(v8::Local exports, void* priv) { v8::Isolate* isolate = context->GetIsolate(); mate::Dictionary dict(isolate, exports); - dict.Set("WebContentsView", mate::CreateConstructor( - isolate, base::Bind(&WebContentsView::New))); + dict.Set("WebContentsView", + mate::CreateConstructor( + isolate, base::BindRepeating(&WebContentsView::New))); } } // namespace diff --git a/atom/browser/api/views/atom_api_box_layout.cc b/atom/browser/api/views/atom_api_box_layout.cc index 8bf7eae0e4a3..32223912b6cf 100644 --- a/atom/browser/api/views/atom_api_box_layout.cc +++ b/atom/browser/api/views/atom_api_box_layout.cc @@ -78,7 +78,7 @@ void Initialize(v8::Local exports, v8::Isolate* isolate = context->GetIsolate(); mate::Dictionary dict(isolate, exports); dict.Set("BoxLayout", mate::CreateConstructor( - isolate, base::Bind(&BoxLayout::New))); + isolate, base::BindRepeating(&BoxLayout::New))); } } // namespace diff --git a/atom/browser/api/views/atom_api_button.cc b/atom/browser/api/views/atom_api_button.cc index f6f68a8fb576..b4c9f8c5ffb6 100644 --- a/atom/browser/api/views/atom_api_button.cc +++ b/atom/browser/api/views/atom_api_button.cc @@ -50,8 +50,8 @@ void Initialize(v8::Local exports, void* priv) { v8::Isolate* isolate = context->GetIsolate(); mate::Dictionary dict(isolate, exports); - dict.Set("Button", - mate::CreateConstructor