aboutsummaryrefslogtreecommitdiffstats
path: root/src/webchannel/qmetaobjectpublisher_p.h
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2014-01-10 14:21:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-06 16:32:20 +0100
commit54f66cc7a1e17155e90a1d3b5c33f627dbd0d50f (patch)
tree6dd4b35eda74487977bfae5bb0b81a133dfc1bf4 /src/webchannel/qmetaobjectpublisher_p.h
parent05bafd509ca302fc63465fece7cd0c33ec602e31 (diff)
Make the underlying transport mechanism of the webchannel pluggable.
This enables us to optionally use navigator.qt instead of a WebSocket, which is nicer setup-wise and is also slightly faster: navigator.qt: 284.0 msecs per iteration (total: 2,840, iterations: 10) WebSocket: 295.8 msecs per iteration (total: 2,959, iterations: 10) The baseline is ca. 203 msecs, which would mean a performance boost of ca. 12.7%. Furthermore, this sets the fundation to eventually add a WebEngine transport mechanism. The WebViewTransport should also be removed and instead the WebView itself should directly implement the WebChannelTransportInterface. Change-Id: I368bb27e38ffa2f17ffeb7f5ae695690f6f5ad21 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/webchannel/qmetaobjectpublisher_p.h')
-rw-r--r--src/webchannel/qmetaobjectpublisher_p.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/webchannel/qmetaobjectpublisher_p.h b/src/webchannel/qmetaobjectpublisher_p.h
index 3e80d24..ff077e7 100644
--- a/src/webchannel/qmetaobjectpublisher_p.h
+++ b/src/webchannel/qmetaobjectpublisher_p.h
@@ -50,16 +50,17 @@
#include <QBasicTimer>
#include <QPointer>
+#include "qwebchannelglobal.h"
+#include "qwebchanneltransportinterface.h"
+
QT_BEGIN_NAMESPACE
class QWebChannel;
-#include "qwebchannelglobal.h"
-
-class Q_WEBCHANNEL_EXPORT QMetaObjectPublisher : public QObject
+class Q_WEBCHANNEL_EXPORT QMetaObjectPublisher : public QObject, public QWebChannelMessageHandlerInterface
{
Q_OBJECT
-
+ Q_INTERFACES(QWebChannelMessageHandlerInterface)
public:
QMetaObjectPublisher(QWebChannel *webChannel);
virtual ~QMetaObjectPublisher();
@@ -160,14 +161,10 @@ public:
*/
void setBlockUpdates(bool block);
-public slots:
/**
- * Helper slot which you can connect directly to WebChannel's rawMessageReceived signal.
- *
- * This slot then tries to parse the message as JSON and if it succeeds, calls handleRequest
- * with the obtained JSON object.
+ * Parse the message as JSON and if it succeeds, call handleRequest with the obtained JSON object.
*/
- void handleRawMessage(const QString &message);
+ void handleMessage(const QString &message) Q_DECL_OVERRIDE;
signals:
void blockUpdatesChanged(bool block);