perf: cache whether or not ELECTRON_DEBUG_NOTIFICATIONS env var is set (#45143)

* perf: cache whether or not ELECTRON_DEBUG_NOTIFICATIONS env var is set

* chore: remove unused #include
This commit is contained in:
Charles Kerr 2025-01-08 20:46:17 -06:00 committed by GitHub
parent 59ed1db9a2
commit 062d14e553
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 12 additions and 12 deletions

View file

@ -44,7 +44,7 @@ void CocoaNotification::Show(const NotificationOptions& options) {
[notification_ setInformativeText:base::SysUTF16ToNSString(options.msg)];
[notification_ setIdentifier:identifier];
if (getenv("ELECTRON_DEBUG_NOTIFICATIONS")) {
if (electron::debug_notifications) {
LOG(INFO) << "Notification created (" << [identifier UTF8String] << ")";
}
@ -170,7 +170,7 @@ void CocoaNotification::NotificationDismissed() {
}
void CocoaNotification::LogAction(const char* action) {
if (getenv("ELECTRON_DEBUG_NOTIFICATIONS") && notification_) {
if (electron::debug_notifications && notification_) {
NSString* identifier = [notification_ valueForKey:@"identifier"];
DCHECK(identifier);
LOG(INFO) << "Notification " << action << " (" << [identifier UTF8String]

View file

@ -39,7 +39,7 @@
didActivateNotification:(NSUserNotification*)notif {
auto* notification = presenter_->GetNotification(notif);
if (getenv("ELECTRON_DEBUG_NOTIFICATIONS")) {
if (electron::debug_notifications) {
LOG(INFO) << "Notification activated (" << [notif.identifier UTF8String]
<< ")";
}

View file

@ -30,7 +30,7 @@ CocoaNotification* NotificationPresenterMac::GetNotification(
return native_notification;
}
if (getenv("ELECTRON_DEBUG_NOTIFICATIONS")) {
if (electron::debug_notifications) {
LOG(INFO) << "Could not find notification for "
<< [ns_notification.identifier UTF8String];
}