Implement shutdown event for macOS
This commit is contained in:
parent
c470e758cc
commit
983e1b1a70
7 changed files with 25 additions and 6 deletions
|
@ -18,8 +18,10 @@ namespace api {
|
|||
PowerMonitor::PowerMonitor(v8::Isolate* isolate) {
|
||||
#if defined(OS_LINUX)
|
||||
SetShutdownHandler(base::Bind(&PowerMonitor::ShouldShutdown,
|
||||
// Passed to base class, no need for weak ptr.
|
||||
base::Unretained(this)));
|
||||
#elif defined(OS_MACOSX)
|
||||
Browser::Get()->SetShutdownHandler(base::Bind(&PowerMonitor::ShouldShutdown,
|
||||
base::Unretained(this)));
|
||||
#endif
|
||||
base::PowerMonitor::Get()->AddObserver(this);
|
||||
Init(isolate);
|
||||
|
@ -30,7 +32,7 @@ PowerMonitor::~PowerMonitor() {
|
|||
}
|
||||
|
||||
bool PowerMonitor::ShouldShutdown() {
|
||||
return Emit("shutdown");
|
||||
return !Emit("shutdown");
|
||||
}
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue