Changeset View
Changeset View
Standalone View
Standalone View
host/abstractbrowserplugin.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 43 | { | |||
---|---|---|---|---|---|
45 | data[QStringLiteral("subsystem")] = m_subsystem; | 45 | data[QStringLiteral("subsystem")] = m_subsystem; | ||
46 | data[QStringLiteral("action")] = action; | 46 | data[QStringLiteral("action")] = action; | ||
47 | if (!payload.isEmpty()) { | 47 | if (!payload.isEmpty()) { | ||
48 | data[QStringLiteral("payload")] = payload; | 48 | data[QStringLiteral("payload")] = payload; | ||
49 | } | 49 | } | ||
50 | Connection::self()->sendData(data); | 50 | Connection::self()->sendData(data); | ||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | void AbstractBrowserPlugin::sendReply(const QJsonObject &payload) | ||||
54 | { | ||||
55 | Q_ASSERT(m_currentRequestSerial > 0); | ||||
56 | | ||||
57 | QJsonObject data{ | ||||
58 | {QStringLiteral("replyToSerial"), m_currentRequestSerial}, | ||||
fvogt: IMO printing a warning and maybe not doing anything is more fitting here than an assert which… | |||||
59 | }; | ||||
60 | | ||||
61 | if (!payload.isEmpty()) { | ||||
62 | data.insert(QStringLiteral("payload"), payload); | ||||
63 | } | ||||
64 | | ||||
65 | Connection::self()->sendData(data); | ||||
66 | } | ||||
67 | | ||||
53 | bool AbstractBrowserPlugin::onLoad() | 68 | bool AbstractBrowserPlugin::onLoad() | ||
54 | { | 69 | { | ||
55 | return true; | 70 | return true; | ||
56 | } | 71 | } | ||
57 | 72 | | |||
58 | bool AbstractBrowserPlugin::onUnload() | 73 | bool AbstractBrowserPlugin::onUnload() | ||
59 | { | 74 | { | ||
60 | return true; | 75 | return true; | ||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |
IMO printing a warning and maybe not doing anything is more fitting here than an assert which only works in debug builds and is then fatal.