diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2014-01-10 14:21:05 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-06 16:32:20 +0100 |
commit | 54f66cc7a1e17155e90a1d3b5c33f627dbd0d50f (patch) | |
tree | 6dd4b35eda74487977bfae5bb0b81a133dfc1bf4 /src/webchannel/qwebchannel.h | |
parent | 05bafd509ca302fc63465fece7cd0c33ec602e31 (diff) | |
download | qtwebchannel-54f66cc7a1e17155e90a1d3b5c33f627dbd0d50f.tar.gz |
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/qwebchannel.h')
-rw-r--r-- | src/webchannel/qwebchannel.h | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/webchannel/qwebchannel.h b/src/webchannel/qwebchannel.h index bf9c5fd..f6965e0 100644 --- a/src/webchannel/qwebchannel.h +++ b/src/webchannel/qwebchannel.h @@ -51,24 +51,17 @@ QT_BEGIN_NAMESPACE struct QWebChannelPrivate; +class QWebChannelTransportInterface; class Q_WEBCHANNEL_EXPORT QWebChannel : public QObject { Q_OBJECT Q_DISABLE_COPY(QWebChannel) - Q_PROPERTY(QString baseUrl READ baseUrl NOTIFY baseUrlChanged) - Q_PROPERTY(bool useSecret READ useSecret WRITE setUseSecret) Q_PROPERTY(bool blockUpdates READ blockUpdates WRITE setBlockUpdates NOTIFY blockUpdatesChanged); - public: QWebChannel(QObject *parent = 0); ~QWebChannel(); - QString baseUrl() const; - - void setUseSecret(bool); - bool useSecret() const; - /** * Register a map of string ID to QObject* objects. * @@ -96,21 +89,15 @@ public: */ void setBlockUpdates(bool block); -signals: - void baseUrlChanged(const QString& baseUrl); - void rawMessageReceived(const QString& rawMessage); - void pongReceived(); - void initialized(); - - void failed(const QString& reason); + void connectTo(QWebChannelTransportInterface *transport); + void disconnectFrom(QWebChannelTransportInterface *transport); +signals: void blockUpdatesChanged(bool block); public slots: void sendMessage(const QJsonValue& id, const QJsonValue& data = QJsonValue()) const; void respond(const QJsonValue& messageId, const QJsonValue& data = QJsonValue()) const; - void sendRawMessage(const QString& rawMessage) const; - void ping() const; private: QScopedPointer<QWebChannelPrivate> d; |