diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-04-15 12:45:59 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-04-20 14:32:58 +0000 |
commit | d56128c315ad89dddf507b10dc4332d05cc42f91 (patch) | |
tree | 65a2b340c82350d95cb29a1576e1053d6ba84a0c /src/core/url_request_custom_job.h | |
parent | 5b8aad9fa24caeb50ff3640d01590a15ee4e23d8 (diff) |
Improve thread-safety of custom scheme handlers
Avoids accessing the QWebEngineUrlSchemeHandler from any other thread
than the UI thread, since it may be deleted at any time on the UI
thread.
Change-Id: Icb4331b3c36f6f619a9fd975d155a9fd608dc5e9
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/core/url_request_custom_job.h')
-rw-r--r-- | src/core/url_request_custom_job.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/url_request_custom_job.h b/src/core/url_request_custom_job.h index eedb41814..be1598ccc 100644 --- a/src/core/url_request_custom_job.h +++ b/src/core/url_request_custom_job.h @@ -45,17 +45,17 @@ #include <QtCore/QPointer> QT_FORWARD_DECLARE_CLASS(QIODevice) -QT_FORWARD_DECLARE_CLASS(QWebEngineUrlSchemeHandler) namespace QtWebEngineCore { +class BrowserContextAdapter; class URLRequestCustomJobDelegate; class URLRequestCustomJobShared; // A request job that handles reading custom URL schemes class URLRequestCustomJob : public net::URLRequestJob { public: - URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, QWebEngineUrlSchemeHandler *schemeHandler); + URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, const std::string &scheme, QWeakPointer<const BrowserContextAdapter> adapter); virtual void Start() Q_DECL_OVERRIDE; virtual void Kill() Q_DECL_OVERRIDE; virtual bool ReadRawData(net::IOBuffer *buf, int bufSize, int *bytesRead) Q_DECL_OVERRIDE; @@ -67,7 +67,8 @@ protected: virtual ~URLRequestCustomJob(); private: - QWebEngineUrlSchemeHandler *m_schemeHandler; + std::string m_scheme; + QWeakPointer<const BrowserContextAdapter> m_adapter; URLRequestCustomJobShared *m_shared; friend class URLRequestCustomJobShared; |