diff options
author | Michal Klocek <michal.klocek@qt.io> | 2018-01-11 11:24:48 +0100 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2018-05-18 10:49:44 +0000 |
commit | cfddf26f78e521809a17d4fab5bb7cfe18d3f08e (patch) | |
tree | 5da7f2d15afd944f6b0bcdfab4e798063f2e582f /src/core/net/url_request_context_getter_qt.h | |
parent | 7d6f72463ef372aabf4c4e6f212b9d331ef1338a (diff) |
Change BrowserContextAdapter to be QPointer
BrowserContextAdapter is living and accessed only in UI thread,
remove QSharedPointer usage and change QWebengineProfile to use
QPointer. Prevent BrowserContextAdapter outliving WebEngineContext
by setting globalObject as a parent to track WebEngineContext
destruction.
This commits tries to simplify the life cycle handling
of browser context, it removes profile shutdown
methods and QWebEngineBrowserContext, which was used
to track profile destruction.
Task-number: QTBUG-62147
Change-Id: I79f2c38a123cd053e3a59f4900afbdc759a396fe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/net/url_request_context_getter_qt.h')
-rw-r--r-- | src/core/net/url_request_context_getter_qt.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/net/url_request_context_getter_qt.h b/src/core/net/url_request_context_getter_qt.h index 0eb4a2fe4..fbc445e4f 100644 --- a/src/core/net/url_request_context_getter_qt.h +++ b/src/core/net/url_request_context_getter_qt.h @@ -70,7 +70,9 @@ namespace QtWebEngineCore { // FIXME: This class should be split into a URLRequestContextGetter and a ProfileIOData, similar to what chrome does. class URLRequestContextGetterQt : public net::URLRequestContextGetter { public: - URLRequestContextGetterQt(QSharedPointer<BrowserContextAdapter> browserContext, content::ProtocolHandlerMap *protocolHandlers, content::URLRequestInterceptorScopedVector request_interceptors); + URLRequestContextGetterQt(BrowserContextAdapter *browserContext, + content::ProtocolHandlerMap *protocolHandlers, + content::URLRequestInterceptorScopedVector request_interceptors); net::URLRequestContext *GetURLRequestContext() override; scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const override; @@ -82,6 +84,7 @@ public: void updateHttpCache(); void updateJobFactory(); void updateRequestInterceptor(); + void setFullConfiguration(); private: virtual ~URLRequestContextGetterQt(); @@ -98,10 +101,7 @@ private: net::HttpNetworkSession::Params generateNetworkSessionParams(); net::HttpNetworkSession::Context generateNetworkSessionContext(); - void setFullConfiguration(QSharedPointer<BrowserContextAdapter> browserContext); - bool m_ignoreCertificateErrors; - QMutex m_mutex; bool m_contextInitialized; bool m_updateAllStorage; @@ -110,9 +110,10 @@ private: bool m_updateJobFactory; bool m_updateUserAgent; - QWeakPointer<BrowserContextAdapter> m_browserContext; + // m_browserContext is never dereferenced in IO thread and it is passed by + // qpointer in generateJobFactory + QPointer<BrowserContextAdapter> m_browserContextAdapter; content::ProtocolHandlerMap m_protocolHandlers; - QAtomicPointer<net::ProxyConfigService> m_proxyConfigService; std::unique_ptr<net::URLRequestContext> m_urlRequestContext; std::unique_ptr<NetworkDelegateQt> m_networkDelegate; |