summaryrefslogtreecommitdiffstats
path: root/src/core/url_request_context_getter_qt.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-01-19 16:31:49 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-01-19 16:29:24 +0000
commit07b431f20f2d6827f944087775f3dd1bd3f69aea (patch)
treec595b4aa16d2d8079bc8fae72260021f723049c2 /src/core/url_request_context_getter_qt.cpp
parentbbf1d3d981da0a12a0ad610b17e365ccddf58c6c (diff)
Avoid full storage update on installing URL scheme handlers
When installing/removing URL scheme handlers, do not update the full URLRequestContextStorage. Only update the job factory. This avoids calling the - potentially expensive - generateStorage() method superfluously often. Change-Id: I99c4ec479fcfdee4e97d86b858ea42f3cdccfec4 Task-number: QTBUG-50160 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/core/url_request_context_getter_qt.cpp')
-rw-r--r--src/core/url_request_context_getter_qt.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp
index 26e2633d8..618354d1c 100644
--- a/src/core/url_request_context_getter_qt.cpp
+++ b/src/core/url_request_context_getter_qt.cpp
@@ -294,6 +294,13 @@ void URLRequestContextGetterQt::updateHttpCache()
}
}
+void URLRequestContextGetterQt::updateJobFactory()
+{
+ Q_ASSERT(m_jobFactory);
+
+ content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestContextGetterQt::generateJobFactory, this));
+}
+
static bool doNetworkSessionParamsMatch(const net::HttpNetworkSession::Params &first, const net::HttpNetworkSession::Params &second)
{
if (first.transport_security_state != second.transport_security_state)
@@ -389,8 +396,8 @@ void URLRequestContextGetterQt::generateHttpCache()
void URLRequestContextGetterQt::generateJobFactory()
{
Q_ASSERT(m_urlRequestContext);
- Q_ASSERT(!m_jobFactory);
+ m_jobFactory.reset();
scoped_ptr<net::URLRequestJobFactoryImpl> jobFactory(new net::URLRequestJobFactoryImpl());
{
@@ -398,7 +405,6 @@ void URLRequestContextGetterQt::generateJobFactory()
content::ProtocolHandlerMap::iterator it = m_protocolHandlers.find(url::kBlobScheme);
Q_ASSERT(it != m_protocolHandlers.end());
jobFactory->SetProtocolHandler(it->first, it->second.release());
- m_protocolHandlers.clear();
}
jobFactory->SetProtocolHandler(url::kDataScheme, new net::DataProtocolHandler());