Bug 1635577 - add wakelog log. r=spohl,karlt

Differential Revision: https://phabricator.services.mozilla.com/D73949
This commit is contained in:
alwu 2020-05-07 19:51:30 +00:00
Родитель b8809d1e54
Коммит 635e073f6f
2 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -83,6 +83,8 @@ class MacWakeLockListener final : public nsIDOMMozWakeLockListener {
shouldKeepDisplayOn ? kIOPMAssertionTypeNoDisplaySleep : kIOPMAssertionTypeNoIdleSleep;
IOPMAssertionID& assertionId =
shouldKeepDisplayOn ? mAssertionNoDisplaySleepID : mAssertionNoIdleSleepID;
WAKE_LOCK_LOG("topic=%s, shouldKeepDisplayOn=%d", NS_ConvertUTF16toUTF8(aTopic).get(),
shouldKeepDisplayOn);
// Note the wake lock code ensures that we're not sent duplicate
// "locked-foreground" notifications when multiple wake locks are held.

Просмотреть файл

@ -42,6 +42,10 @@ NS_IMPL_ISUPPORTS(WakeLockListener, nsIDOMMozWakeLockListener)
StaticRefPtr<WakeLockListener> WakeLockListener::sSingleton;
# define WAKE_LOCK_LOG(...) \
MOZ_LOG(gLinuxWakeLockLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
static mozilla::LazyLogModule gLinuxWakeLockLog("LinuxWakeLock");
enum DesktopEnvironment {
FreeDesktop,
GNOME,
@ -484,6 +488,8 @@ nsresult WakeLockListener::Callback(const nsAString& topic,
// Treat "locked-background" the same as "unlocked" on desktop linux.
bool shouldLock = state.EqualsLiteral("locked-foreground");
WAKE_LOCK_LOG("topic=%s, shouldLock=%d", NS_ConvertUTF16toUTF8(topic).get(),
shouldLock);
return shouldLock ? topicLock->InhibitScreensaver()
: topicLock->UninhibitScreensaver();