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

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

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* chore: remove unused #include

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-01-09 09:22:58 -06:00 committed by GitHub
parent b70d2944ff
commit 3a4edd7a2b
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"
@ -29,10 +28,6 @@ namespace electron {
namespace {
bool IsDebuggingNotifications() {
return base::Environment::Create()->HasVar("ELECTRON_DEBUG_NOTIFICATIONS");
}
bool SaveIconToPath(const SkBitmap& bitmap, const base::FilePath& path) {
std::vector<unsigned char> png_data;
if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data))
@ -53,7 +48,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;