Merge pull request #5720 from danhp/release-single-instance

Add 'app.releaseSingleInstance()'
This commit is contained in:
Cheng Zhao 2016-05-30 00:51:13 +00:00
commit 26fa963a70
3 changed files with 15 additions and 1 deletions

View file

@ -401,6 +401,13 @@ bool App::MakeSingleInstance(
} }
} }
void App::ReleaseSingleInstance() {
if (process_singleton_.get()) {
process_singleton_->Cleanup();
process_singleton_.reset();
}
}
#if defined(USE_NSS_CERTS) #if defined(USE_NSS_CERTS)
void App::ImportCertificate( void App::ImportCertificate(
const base::DictionaryValue& options, const base::DictionaryValue& options,
@ -480,7 +487,8 @@ void App::BuildPrototype(
#if defined(USE_NSS_CERTS) #if defined(USE_NSS_CERTS)
.SetMethod("importCertificate", &App::ImportCertificate) .SetMethod("importCertificate", &App::ImportCertificate)
#endif #endif
.SetMethod("makeSingleInstance", &App::MakeSingleInstance); .SetMethod("makeSingleInstance", &App::MakeSingleInstance)
.SetMethod("releaseSingleInstance", &App::ReleaseSingleInstance);
} }
} // namespace api } // namespace api

View file

@ -108,6 +108,7 @@ class App : public AtomBrowserClient::Delegate,
void SetDesktopName(const std::string& desktop_name); void SetDesktopName(const std::string& desktop_name);
bool MakeSingleInstance( bool MakeSingleInstance(
const ProcessSingleton::NotificationCallback& callback); const ProcessSingleton::NotificationCallback& callback);
void ReleaseSingleInstance();
std::string GetLocale(); std::string GetLocale();
#if defined(USE_NSS_CERTS) #if defined(USE_NSS_CERTS)

View file

@ -496,6 +496,11 @@ app.on('ready', () => {
}); });
``` ```
### `app.releaseSingleInstance()`
Releases all locks that were created by `makeSingleInstance`. This will allow
multiple instances of the application to once again run side by side.
### `app.setUserActivity(type, userInfo[, webpageURL])` _OS X_ ### `app.setUserActivity(type, userInfo[, webpageURL])` _OS X_
* `type` String - Uniquely identifies the activity. Maps to * `type` String - Uniquely identifies the activity. Maps to