diff options
author | Michal Klocek <michal.klocek@qt.io> | 2020-04-16 13:20:04 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2020-04-20 09:44:53 +0200 |
commit | a05bb73747620dd8f0294a57ff690a4f4202884e (patch) | |
tree | fcbdd58b8b03b8233035699aaf6b4d4498f89c8e /src/webenginewidgets/api/qwebenginepage.cpp | |
parent | 41e8f7046949b7418c6780e342ddc0c2d4bbd026 (diff) |
Move request interceptor to ui thread
We use now network service avoid io-ui-io-ui hops,
pipe proxying url loader factory directly to ui thread.
This solves thread safty issues.
Add deprecated request interceptor test cases.
Task-number: QTBUG-83082
Task-number: QTBUG-82999
Change-Id: I38778cf1a70789c5e92e04c93d1c93e2cc4c765a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage.cpp')
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 0d2988421..b267c5dd1 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -163,7 +163,6 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile) , webChannelWorldId(QWebEngineScript::MainWorld) , defaultAudioMuted(false) , defaultZoomFactor(1.0) - , requestInterceptor(nullptr) #if QT_CONFIG(webengine_printing_and_pdf) , currentPrinter(nullptr) #endif @@ -185,8 +184,6 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile) QWebEnginePagePrivate::~QWebEnginePagePrivate() { - if (requestInterceptor) - profile->d_ptr->profileAdapter()->removePageRequestInterceptor(); delete history; delete settings; profile->d_ptr->removeWebContentsAdapterClient(this); @@ -1916,20 +1913,7 @@ void QWebEnginePagePrivate::visibleChanged(bool visible) void QWebEnginePage::setUrlRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor) { Q_D(QWebEnginePage); - bool hadInterceptorChanged = bool(d->requestInterceptor) != bool(interceptor); - d->requestInterceptor = interceptor; - if (hadInterceptorChanged) { - if (interceptor) - d->profile->d_ptr->profileAdapter()->addPageRequestInterceptor(); - else - d->profile->d_ptr->profileAdapter()->removePageRequestInterceptor(); - } -} - -void QWebEnginePagePrivate::interceptRequest(QWebEngineUrlRequestInfo &info) -{ - if (requestInterceptor) - requestInterceptor->interceptRequest(info); + d->adapter->setRequestInterceptor(interceptor); } #if QT_CONFIG(menu) |