mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-02 20:26:59 +01:00
Fix shutdown crash in InitNetworkContext with multi-threaded message loop (fixes issue #2985)
This commit is contained in:
parent
fab2af8876
commit
e87fedd27c
@ -1296,6 +1296,15 @@ void AlloyContentBrowserClient::ConfigureNetworkContextParams(
|
||||
const base::FilePath& relative_partition_path,
|
||||
network::mojom::NetworkContextParams* network_context_params,
|
||||
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) {
|
||||
// This method may be called during shutdown when using multi-threaded
|
||||
// message loop mode. In that case exit early to avoid crashes.
|
||||
if (!SystemNetworkContextManager::GetInstance()) {
|
||||
// This must match the value expected in
|
||||
// StoragePartitionImpl::InitNetworkContext.
|
||||
network_context_params->context_name = "magic_shutting_down";
|
||||
return;
|
||||
}
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(context);
|
||||
profile->ConfigureNetworkContextParams(in_memory, relative_partition_path,
|
||||
network_context_params,
|
||||
|
@ -401,7 +401,7 @@ patches = [
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2718
|
||||
#
|
||||
# Fix shutdown crash in InitNetworkContext with multi-threaded message loop.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2703
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2985
|
||||
#
|
||||
# Compute correct default quota when cache_path is unspecified.
|
||||
'name': 'services_network_2718',
|
||||
|
@ -1,5 +1,5 @@
|
||||
diff --git content/browser/storage_partition_impl.cc content/browser/storage_partition_impl.cc
|
||||
index a0034ad3a21d..80fa8da263ac 100644
|
||||
index a0034ad3a21d..bf694fdf18d0 100644
|
||||
--- content/browser/storage_partition_impl.cc
|
||||
+++ content/browser/storage_partition_impl.cc
|
||||
@@ -490,10 +490,6 @@ class LoginHandlerDelegate {
|
||||
@ -40,15 +40,15 @@ index a0034ad3a21d..80fa8da263ac 100644
|
||||
storage::GetDefaultDeviceInfoHelper(), std::move(callback));
|
||||
}
|
||||
|
||||
@@ -2396,7 +2390,10 @@ void StoragePartitionImpl::InitNetworkContext() {
|
||||
network_context_.reset();
|
||||
GetNetworkService()->CreateNetworkContext(
|
||||
network_context_.BindNewPipeAndPassReceiver(), std::move(context_params));
|
||||
- DCHECK(network_context_);
|
||||
+ if (!network_context_) {
|
||||
+ // May happen during shutdown.
|
||||
@@ -2371,6 +2365,11 @@ void StoragePartitionImpl::InitNetworkContext() {
|
||||
GetContentClient()->browser()->ConfigureNetworkContextParams(
|
||||
browser_context_, is_in_memory_, relative_partition_path_,
|
||||
context_params.get(), cert_verifier_creation_params.get());
|
||||
+ if (context_params->context_name &&
|
||||
+ *context_params->context_name == "magic_shutting_down") {
|
||||
+ // Don't re-initialize the network context during shutdown.
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
network_context_client_receiver_.reset();
|
||||
network_context_->SetClient(
|
||||
devtools_instrumentation::ApplyNetworkContextParamsOverrides(
|
||||
browser_context_, context_params.get());
|
||||
DCHECK(!context_params->cert_verifier_params)
|
||||
|
Loading…
x
Reference in New Issue
Block a user