summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2019-12-02 21:36:46 -0800
committerThiago Macieira <thiago.macieira@intel.com>2020-02-24 23:35:23 +0000
commit9691111bcb359fe39e97e13820b98385657ae03a (patch)
treed31b7e037fe7d2024de391eaa030ae2047384050
parent97bfaef8a39419d9524ef6ebbd073e5aee9c9c7d (diff)
Fix build: remove dependency on Qt private header
The size of QJsonDocument's binary format is well known and we don't need the header to know what it is. This fixes the build with 5.15, where the contents of the previous QJsonPrivate namespace are now in QBinaryJsonPrivate. web_channel_ipc_transport_host.cpp:148:51: error: 'Header' is not a member of 'QJsonPrivate' Change-Id: Id7decde0c426479bbf61fffd15dcc5c20a9eca2c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
index b1aab00a1..9758f73bf 100644
--- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp
+++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
@@ -52,10 +52,13 @@
#include <QJsonObject>
#include <QLoggingCategory>
-#include <QtCore/private/qjson_p.h>
-
namespace QtWebEngineCore {
+enum {
+ // sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)
+ MinimumBinaryJsonSize = 8 + 12
+};
+
Q_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport")
inline QDebug operator<<(QDebug stream, content::RenderFrameHost *frame)
@@ -145,7 +148,7 @@ void WebChannelIPCTransportHost::DispatchWebChannelMessage(const std::vector<uin
QJsonDocument doc;
// QJsonDocument::fromRawData does not check the length before it starts
// parsing the QJsonPrivate::Header and QJsonPrivate::Base structures.
- if (binaryJson.size() >= sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base))
+ if (binaryJson.size() >= MinimumBinaryJsonSize)
doc = QJsonDocument::fromRawData(reinterpret_cast<const char *>(binaryJson.data()),
binaryJson.size());