summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-02-04 15:40:12 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-02-12 11:51:21 +0000
commite5cb3293115eaf101de763ce362a6e1f59fcb4ca (patch)
treeda5ea428e214941615d7b14781d5f0dd7e136eb4
parentc19eb3387bfd38099a9f1d79e63f968139c9613d (diff)
downloadqtwebengine-chromium-e5cb3293115eaf101de763ce362a6e1f59fcb4ca.tar.gz
The first network-context doesn't have to be primary
Change-Id: I1d49b25c6e2192cee509cf6369052cd411ba3c82 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
-rw-r--r--chromium/services/network/network_service.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/chromium/services/network/network_service.cc b/chromium/services/network/network_service.cc
index 7546a3f2528..dce58f2da07 100644
--- a/chromium/services/network/network_service.cc
+++ b/chromium/services/network/network_service.cc
@@ -320,10 +320,17 @@ std::unique_ptr<NetworkService> NetworkService::CreateForTesting() {
}
void NetworkService::RegisterNetworkContext(NetworkContext* network_context) {
+#ifndef TOOLKIT_QT
// If IsPrimaryNetworkContext() is true, there must be no other
// NetworkContexts created yet.
DCHECK(!network_context->IsPrimaryNetworkContext() ||
network_contexts_.empty());
+#else
+ if (network_context->IsPrimaryNetworkContext()) {
+ host_resolver_manager_->SetRequestContextForProbes(
+ network_context->url_request_context());
+ }
+#endif
DCHECK_EQ(0u, network_contexts_.count(network_context));
network_contexts_.insert(network_context);
@@ -332,10 +339,12 @@ void NetworkService::RegisterNetworkContext(NetworkContext* network_context) {
}
void NetworkService::DeregisterNetworkContext(NetworkContext* network_context) {
+#ifndef TOOLKIT_QT
// If the NetworkContext is the primary network context, all other
// NetworkContexts must already have been destroyed.
DCHECK(!network_context->IsPrimaryNetworkContext() ||
network_contexts_.size() == 1);
+#endif
DCHECK_EQ(1u, network_contexts_.count(network_context));
network_contexts_.erase(network_context);
@@ -397,9 +406,11 @@ void NetworkService::SetSSLKeyLogFile(base::File file) {
void NetworkService::CreateNetworkContext(
mojo::PendingReceiver<mojom::NetworkContext> receiver,
mojom::NetworkContextParamsPtr params) {
+#ifndef TOOLKIT_QT
// Only the first created NetworkContext can have |primary_next_context| set
// to true.
DCHECK(!params->primary_network_context || network_contexts_.empty());
+#endif
owned_network_contexts_.emplace(std::make_unique<NetworkContext>(
this, std::move(receiver), std::move(params),
@@ -425,6 +436,7 @@ void NetworkService::ConfigureStubHostResolver(
host_resolver_manager_->SetRequestContextForProbes(
network_context->url_request_context());
+ break;
}
// Configure DNS over HTTPS.
@@ -701,8 +713,12 @@ void NetworkService::DestroyNetworkContexts() {
void NetworkService::OnNetworkContextConnectionClosed(
NetworkContext* network_context) {
if (network_context->IsPrimaryNetworkContext()) {
+#ifndef TOOLKIT_QT
DestroyNetworkContexts();
return;
+#else
+ host_resolver_manager_->CancelProbesForContext(network_context->url_request_context());
+#endif
}
auto it = owned_network_contexts_.find(network_context);