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/webenginewidgets/api/qwebengineprofile_p.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/webenginewidgets/api/qwebengineprofile_p.h')
-rw-r--r-- | src/webenginewidgets/api/qwebengineprofile_p.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h index 72fa904e4..d3bfe0b91 100644 --- a/src/webenginewidgets/api/qwebengineprofile_p.h +++ b/src/webenginewidgets/api/qwebengineprofile_p.h @@ -73,10 +73,12 @@ class QWebEngineSettings; class QWebEngineProfilePrivate : public QtWebEngineCore::BrowserContextAdapterClient { public: Q_DECLARE_PUBLIC(QWebEngineProfile) - QWebEngineProfilePrivate(QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContext); + QWebEngineProfilePrivate(const QString &storageName = QString()); + // This is used only by global profile + QWebEngineProfilePrivate(QtWebEngineCore::BrowserContextAdapter *browserContextAdapter); ~QWebEngineProfilePrivate(); - QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContext() const; + QtWebEngineCore::BrowserContextAdapter* browserContext() const; QWebEngineSettings *settings() const { return m_settings; } void downloadDestroyed(quint32 downloadId); @@ -87,8 +89,8 @@ public: private: QWebEngineProfile *q_ptr; QWebEngineSettings *m_settings; + QPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextAdapter; QScopedPointer<QWebEngineScriptCollection> m_scriptCollection; - QPointer<QWebEngineBrowserContext> m_browserContext; QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads; }; |