PR feedback

This commit is contained in:
Brad Davis 2019-08-26 11:46:04 -07:00
parent dfd78a2662
commit e1bf3f2540
4 changed files with 11 additions and 5 deletions

View file

@ -956,7 +956,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
DependencyManager::set<AvatarPackager>();
PlatformHelper::setup();
QObject::connect(DependencyManager::get<PlatformHelper>().get(), &PlatformHelper::systemWillWake, [] {
QObject::connect(PlatformHelper::instance(), &PlatformHelper::systemWillWake, [] {
QMetaObject::invokeMethod(DependencyManager::get<NodeList>().data(), "noteAwakening", Qt::QueuedConnection);
});
@ -1167,13 +1167,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// Pause the deadlock watchdog when we sleep, or it might
// trigger a false positive when we wake back up
auto platformHelper = DependencyManager::get<PlatformHelper>();
auto platformHelper = PlatformHelper::instance();
connect(platformHelper.get(), &PlatformHelper::systemWillSleep, [] {
connect(platformHelper, &PlatformHelper::systemWillSleep, [] {
DeadlockWatchdogThread::pause();
});
connect(platformHelper.get(), &PlatformHelper::systemWillWake, [] {
connect(platformHelper, &PlatformHelper::systemWillWake, [] {
DeadlockWatchdogThread::resume();
});

View file

@ -25,3 +25,7 @@ void PlatformHelper::shutdown() {
DependencyManager::destroy<PlatformHelper>();
}
PlatformHelper* PlatformHelper::instance() {
return DependencyManager::get<PlatformHelper>().get();
}

View file

@ -32,6 +32,8 @@ public:
static void setup();
// Run the per-platform code to cleanly shutdown a platform-dependent PlatformHelper dependency object
static void shutdown();
// Fetch the platform specific instance of the helper
static PlatformHelper* instance();
std::atomic<bool> _awake{ true };
};

View file

@ -9,7 +9,7 @@
#include "../PlatformHelper.h"
#if !defined(Q_OS_ANDROID) && defined(Q_OS_MAC)
#if defined(Q_OS_MAC)
#include <IOKit/IOMessage.h>
#include <IOKit/pwr_mgt/IOPMLib.h>