refactor: Add ElectronBrowserContext::BrowserContexts()
(35-x-y backport) (#46161)
refactor: Add `ElectronBrowserContext::BrowserContexts()` * 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:
parent
e3d95bb8a4
commit
998de7aa6c
4 changed files with 58 additions and 51 deletions
|
@ -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
|
||||
|
@ -598,11 +596,7 @@ void ElectronBrowserMainParts::PostMainMessageLoopRun() {
|
|||
node_bindings_->set_uv_env(nullptr);
|
||||
node_env_.reset();
|
||||
|
||||
auto default_context_key = ElectronBrowserContext::PartitionKey("", false);
|
||||
std::unique_ptr<ElectronBrowserContext> default_context = std::move(
|
||||
ElectronBrowserContext::browser_context_map()[default_context_key]);
|
||||
ElectronBrowserContext::browser_context_map().clear();
|
||||
default_context.reset();
|
||||
ElectronBrowserContext::DestroyAllContexts();
|
||||
|
||||
fake_browser_process_->PostMainMessageLoopRun();
|
||||
content::DevToolsAgentHost::StopRemoteDebuggingPipeHandler();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue