chore: do not initialize web browser unless explicitly needed

This commit is contained in:
Almamu 2025-04-01 12:23:55 +02:00
parent 6c0a9c12d5
commit 05854b5984
3 changed files with 7 additions and 13 deletions

View File

@ -36,8 +36,8 @@ class CPulseAudioPlaybackRecorder final : public CPlaybackRecorder {
pa_context* m_context;
pa_stream* m_captureStream;
float fft_destination64 [64];
float fft_destination32 [32];
float fft_destination16 [16];
float fft_destination64 [64] = {0};
float fft_destination32 [32] = {0};
float fft_destination16 [16] = {0};
};
} // namespace WallpaperEngine::Audio::Drivers::Recorders

View File

@ -6,22 +6,16 @@
using namespace WallpaperEngine::WebBrowser;
CWebBrowserContext::CWebBrowserContext (int argc, char** argv) : m_stopped (false), m_inUse (false), m_argc (argc), m_argv (argv) {}
CWebBrowserContext::CWebBrowserContext (int argc, char** argv) : m_stopped (true), m_argc (argc), m_argv (argv) {}
CWebBrowserContext::~CWebBrowserContext () {
this->stop ();
}
void CWebBrowserContext::markAsUsed () {
if (!this->m_inUse) {
if (this->m_stopped) {
this->delayedInitialization();
}
this->m_inUse = true;
}
bool CWebBrowserContext::isUsed () const {
return this->m_inUse;
}
void CWebBrowserContext::stop () {
@ -37,6 +31,8 @@ void CWebBrowserContext::stop () {
}
void CWebBrowserContext::delayedInitialization () {
this->m_stopped = false;
// clone original argc/argv as they'll be modified by cef
char** argv2 = new char*[this->m_argc];

View File

@ -7,7 +7,6 @@ namespace WallpaperEngine::WebBrowser {
~CWebBrowserContext();
void markAsUsed();
[[nodiscard]] bool isUsed() const;
void stop();
private:
@ -19,6 +18,5 @@ namespace WallpaperEngine::WebBrowser {
int m_argc;
char** m_argv;
bool m_stopped;
bool m_inUse;
};
} // namespace WallpaperEngine::WebBrowser