refactor: Add ElectronBrowserContext::BrowserContexts() (#46158)

* refactor: add ElectronBrowserContext::BrowserContexts()

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

* refactor: use ElectronBrowserContext::BrowserContexts() in ElectronBrowserMainParts::PostMainMessageLoopRun()

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

* refactor: use ElectronBrowserContext::BrowserContexts() in ElectronExtensionsBrowserClient::IsValidContext()

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

* refactor: use ElectronBrowserContext::BrowserContexts() in ElectronExtensionsBrowserClient::BroadcastEventToRenderers()

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

* refactor: move PartitionKey, BrowserContextMap private

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

* refactor: add ElectronBrowserContext::IsValidContext()

decouple ElectronExtensionsBrowserClient from the internals of ElectronBrowserContext

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-03-20 15:42:12 -05:00 committed by GitHub
parent b3526da28e
commit cee2c2ceeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 49 additions and 48 deletions

View file

@ -554,11 +554,9 @@ void ElectronBrowserMainParts::PostMainMessageLoopRun() {
// Shutdown the DownloadManager before destroying Node to prevent
// DownloadItem callbacks from crashing.
for (auto& iter : ElectronBrowserContext::browser_context_map()) {
auto* download_manager = iter.second.get()->GetDownloadManager();
if (download_manager) {
for (auto* browser_context : ElectronBrowserContext::BrowserContexts()) {
if (auto* download_manager = browser_context->GetDownloadManager())
download_manager->Shutdown();
}
}
// Shutdown utility process created with Electron API before