summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorJocelyn Turcotte <jturcotte@woboq.com>2016-07-22 12:45:22 +0200
committerJocelyn Turcotte (Woboq GmbH) <jturcotte@woboq.com>2016-07-28 17:58:51 +0000
commit47d6b5ce11d1014548ba69df5d7b698381a8343e (patch)
treeadbf40737ddbcfb366f9652c26aae264245a6840 /src/core
parente24186f1c08d69473bc450b035b9063d5cc9fefb (diff)
Reinstall the webChannelTransport on render process switch
Since we now have a state on the render process side in WebChannelIPCTransport to know if we should install the web channel transport or not, it's important to keep this state updated if a new render process is spawned for a WebContentsAdapter. Task-number: QTBUG-53411 Change-Id: Id0e9e537dcf09317ca3dafd4020a7ada8d16bb8b Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/web_channel_ipc_transport_host.cpp7
-rw-r--r--src/core/web_channel_ipc_transport_host.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/core/web_channel_ipc_transport_host.cpp b/src/core/web_channel_ipc_transport_host.cpp
index ce5ea320b..aef16f0a0 100644
--- a/src/core/web_channel_ipc_transport_host.cpp
+++ b/src/core/web_channel_ipc_transport_host.cpp
@@ -61,6 +61,13 @@ WebChannelIPCTransportHost::~WebChannelIPCTransportHost()
{
}
+void WebChannelIPCTransportHost::RenderViewHostChanged(content::RenderViewHost *, content::RenderViewHost *)
+{
+ // This means that we were moved into a different RenderView, possibly in a different
+ // render process and that we lost our WebChannelIPCTransport object and its state.
+ Send(new WebChannelIPCTransport_Install(routing_id(), m_worldId));
+}
+
void WebChannelIPCTransportHost::setWorldId(uint worldId)
{
if (worldId == m_worldId)
diff --git a/src/core/web_channel_ipc_transport_host.h b/src/core/web_channel_ipc_transport_host.h
index 9c499ad78..9cc1f3104 100644
--- a/src/core/web_channel_ipc_transport_host.h
+++ b/src/core/web_channel_ipc_transport_host.h
@@ -58,6 +58,9 @@ public:
WebChannelIPCTransportHost(content::WebContents *, uint worldId = 0, QObject *parent = 0);
virtual ~WebChannelIPCTransportHost();
+ // WebContentsObserver
+ virtual void RenderViewHostChanged(content::RenderViewHost* old_host, content::RenderViewHost* new_host) Q_DECL_OVERRIDE;
+
// QWebChannelAbstractTransport
virtual void sendMessage(const QJsonObject &message) Q_DECL_OVERRIDE;