diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-08-26 18:09:59 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-08-29 17:40:47 +0200 |
commit | b3d286ab167a0b689248e8d5cb4dd296aa3e9196 (patch) | |
tree | bf7f502b4945cb0264c7853f114dfb0aad4d215f | |
parent | 63fe3552a5873c9477e0c8c01972d6c2a0bd9674 (diff) |
Ref-count WebContentsAdapter.
This is needed to handle createWindow where a WebContentsAdapter will
be created to wrap the new WebContents and will passed up through the
API. If the application doesn't handle the callback, this will allow
managing the lifetime of the WebContents more easily.
Change-Id: I40ae1973a9bdf8c3d75f9ff137228d48ed92cfb2
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r-- | lib/quick/qquickwebengineview_p_p.h | 4 | ||||
-rw-r--r-- | lib/web_contents_adapter.h | 4 | ||||
-rw-r--r-- | lib/widgets/Api/qwebenginepage_p.h | 4 |
3 files changed, 7 insertions, 5 deletions
diff --git a/lib/quick/qquickwebengineview_p_p.h b/lib/quick/qquickwebengineview_p_p.h index a30c60883..3d74f60de 100644 --- a/lib/quick/qquickwebengineview_p_p.h +++ b/lib/quick/qquickwebengineview_p_p.h @@ -44,7 +44,7 @@ #include "web_contents_adapter_client.h" -#include <QScopedPointer> +#include <QSharedData> #include <QtQuick/private/qquickitem_p.h> class QQuickWebEngineView; @@ -65,7 +65,7 @@ public: virtual void loadFinished(bool success) Q_DECL_OVERRIDE; virtual void focusContainer() Q_DECL_OVERRIDE; - QScopedPointer<WebContentsAdapter> adapter; + QExplicitlySharedDataPointer<WebContentsAdapter> adapter; friend class RenderWidgetHostViewQtDelegateQuick; }; diff --git a/lib/web_contents_adapter.h b/lib/web_contents_adapter.h index 4d3f57b4d..15cc79f40 100644 --- a/lib/web_contents_adapter.h +++ b/lib/web_contents_adapter.h @@ -44,6 +44,7 @@ #include "qtwebengineglobal.h" #include <QScopedPointer> +#include <QSharedData> #include <QString> #include <QUrl> @@ -53,7 +54,7 @@ class WebContents; class WebContentsAdapterClient; class WebContentsAdapterPrivate; -class QWEBENGINE_EXPORT WebContentsAdapter { +class QWEBENGINE_EXPORT WebContentsAdapter : public QSharedData { public: WebContentsAdapter(WebContentsAdapterClient* adapterClient); @@ -78,6 +79,7 @@ public: void clearNavigationHistory(); private: + Q_DISABLE_COPY(WebContentsAdapter); Q_DECLARE_PRIVATE(WebContentsAdapter); QScopedPointer<WebContentsAdapterPrivate> d_ptr; }; diff --git a/lib/widgets/Api/qwebenginepage_p.h b/lib/widgets/Api/qwebenginepage_p.h index b1987cbd0..f43ed9522 100644 --- a/lib/widgets/Api/qwebenginepage_p.h +++ b/lib/widgets/Api/qwebenginepage_p.h @@ -46,7 +46,7 @@ #include "web_contents_adapter_client.h" #include <QtCore/private/qobject_p.h> -#include <QScopedPointer> +#include <QSharedData> class QWebEngineHistory; class QWebEnginePage; @@ -74,7 +74,7 @@ public: void updateNavigationActions(); void _q_webActionTriggered(bool checked); - QScopedPointer<WebContentsAdapter> adapter; + QExplicitlySharedDataPointer<WebContentsAdapter> adapter; QWebEngineHistory *history; QWebEngineView *view; mutable QAction *actions[QWebEnginePage::WebActionCount]; |