From 5d4c29a1e32fe58221e98be534f73da3902f054a Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Tue, 20 Oct 2015 13:27:34 -0700 Subject: [PATCH] Ditch double-callback, just use mate directly --- atom/browser/api/atom_api_app.cc | 19 +++++-------------- atom/browser/api/atom_api_app.h | 8 ++------ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 072686dd8d1..24c8063bc8d 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -269,23 +269,14 @@ v8::Local App::DefaultSession(v8::Isolate* isolate) { return v8::Local::New(isolate, default_session_); } -bool App::OnProcessSingletonNotification( - const base::CommandLine& command_line, - const base::FilePath& current_directory) { - ProcessSingleton::NotificationCallback cb; - mate::Converter::FromV8(isolate(), single_instance_callback_, &cb); - - return cb.Run(command_line, current_directory); -} - bool App::MakeSingleInstance(v8::Local callback) { single_instance_callback_ = callback; - auto browser = Browser::Get(); + ProcessSingleton::NotificationCallback cb; + mate::Converter::FromV8(isolate(), single_instance_callback_, &cb); - auto no_refcount_this = base::Unretained(this); - browser->SetSingleInstanceCallback( - base::Bind(&App::OnProcessSingletonNotification, no_refcount_this)); + auto browser = Browser::Get(); + browser->SetSingleInstanceCallback(cb); switch(browser->GetSingleInstanceResult()) { case ProcessSingleton::NotifyResult::PROCESS_NONE: @@ -295,7 +286,7 @@ bool App::MakeSingleInstance(v8::Local callback) { case ProcessSingleton::NotifyResult::PROCESS_NOTIFIED: return true; } - + return false; } diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index 6654046e828..b8285553b49 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -21,7 +21,7 @@ class FilePath; namespace mate { class Arguments; } - + namespace atom { namespace api { @@ -71,11 +71,7 @@ class App : public mate::EventEmitter, void AllowNTLMCredentialsForAllDomains(bool should_allow); bool MakeSingleInstance(v8::Local callback); - - bool OnProcessSingletonNotification( - const base::CommandLine& command_line, - const base::FilePath& current_directory); - + std::string GetLocale(); v8::Local DefaultSession(v8::Isolate* isolate);