зеркало из https://github.com/mozilla/gecko-dev.git
Bug 993737 - Only fire shutdown notifications on main thread. r=gsvelto
This commit is contained in:
Родитель
fd82821d34
Коммит
9e3b673303
|
@ -9,6 +9,7 @@
|
|||
#include <sys/reboot.h>
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "MainThreadUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace hal_impl {
|
||||
|
@ -16,9 +17,11 @@ namespace hal_impl {
|
|||
void
|
||||
Reboot()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->NotifyObservers(nullptr, "system-reboot", nullptr);
|
||||
if (NS_IsMainThread()) {
|
||||
nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->NotifyObservers(nullptr, "system-reboot", nullptr);
|
||||
}
|
||||
}
|
||||
sync();
|
||||
reboot(RB_AUTOBOOT);
|
||||
|
@ -27,9 +30,11 @@ Reboot()
|
|||
void
|
||||
PowerOff()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->NotifyObservers(nullptr, "system-power-off", nullptr);
|
||||
if (NS_IsMainThread()) {
|
||||
nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->NotifyObservers(nullptr, "system-power-off", nullptr);
|
||||
}
|
||||
}
|
||||
sync();
|
||||
reboot(RB_POWER_OFF);
|
||||
|
|
Загрузка…
Ссылка в новой задаче