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

@ -10,7 +10,6 @@
#include <string>
#include <vector>
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/hash/md5.h"
#include "base/logging.h"
@ -27,10 +26,6 @@ namespace electron {
namespace {
bool IsDebuggingNotifications() {
return base::Environment::Create()->HasVar("ELECTRON_DEBUG_NOTIFICATIONS");
}
bool SaveIconToPath(const SkBitmap& bitmap, const base::FilePath& path) {
std::optional<std::vector<uint8_t>> png_data =
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false);
@ -50,7 +45,7 @@ std::unique_ptr<NotificationPresenter> NotificationPresenter::Create() {
if (!presenter->Init())
return {};
if (IsDebuggingNotifications())
if (electron::debug_notifications)
LOG(INFO) << "Successfully created Windows notifications presenter";
return presenter;