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

* refactor: add ElectronBrowserContext::BrowserContexts()

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

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

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

* refactor: move PartitionKey, BrowserContextMap private

* refactor: add ElectronBrowserContext::IsValidContext()

decouple ElectronExtensionsBrowserClient from the internals of ElectronBrowserContext
This commit is contained in:
Charles Kerr 2025-03-20 11:17:26 -05:00 committed by GitHub
parent 273baf4ec2
commit 46967ca9c9
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