Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qmldebug/qqmlenginecontrolclient.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | QQmlEngineControlClient::QQmlEngineControlClient(QQmlDebugConnection *connection) : | - | ||||||||||||
6 | QQmlDebugClient(*(new QQmlEngineControlClientPrivate(connection))) | - | ||||||||||||
7 | { | - | ||||||||||||
8 | } executed 44 times by 2 tests: end of block Executed by:
| 44 | ||||||||||||
9 | - | |||||||||||||
10 | QQmlEngineControlClient::QQmlEngineControlClient(QQmlEngineControlClientPrivate &dd) : | - | ||||||||||||
11 | QQmlDebugClient(dd) | - | ||||||||||||
12 | { | - | ||||||||||||
13 | } never executed: end of block | 0 | ||||||||||||
14 | void QQmlEngineControlClient::blockEngine(int engineId) | - | ||||||||||||
15 | { | - | ||||||||||||
16 | QQmlEngineControlClientPrivate * const d = d_func(); | - | ||||||||||||
17 | ((d->blockedEngines.contains(engineId)) ? static_cast<void>(0) : qt_assert("d->blockedEngines.contains(engineId)", __FILE__, 70)); | - | ||||||||||||
18 | d->blockedEngines[engineId].blockers++; | - | ||||||||||||
19 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||||||||
20 | - | |||||||||||||
21 | - | |||||||||||||
22 | - | |||||||||||||
23 | - | |||||||||||||
24 | - | |||||||||||||
25 | void QQmlEngineControlClient::releaseEngine(int engineId) | - | ||||||||||||
26 | { | - | ||||||||||||
27 | QQmlEngineControlClientPrivate * const d = d_func(); | - | ||||||||||||
28 | ((d->blockedEngines.contains(engineId)) ? static_cast<void>(0) : qt_assert("d->blockedEngines.contains(engineId)", __FILE__, 81)); | - | ||||||||||||
29 | - | |||||||||||||
30 | QQmlEngineControlClientPrivate::EngineState &state = d->blockedEngines[engineId]; | - | ||||||||||||
31 | if (--
| 0-16 | ||||||||||||
32 | ((state.releaseCommand != QQmlEngineControlClientPrivate::InvalidCommand) ? static_cast<void>(0) : qt_assert("state.releaseCommand != QQmlEngineControlClientPrivate::InvalidCommand", __FILE__, 85)); | - | ||||||||||||
33 | d->sendCommand(state.releaseCommand, engineId); | - | ||||||||||||
34 | d->blockedEngines.remove(engineId); | - | ||||||||||||
35 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||||||||
36 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||||||||
37 | - | |||||||||||||
38 | QList<int> QQmlEngineControlClient::blockedEngines() const | - | ||||||||||||
39 | { | - | ||||||||||||
40 | const QQmlEngineControlClientPrivate * const d = d_func(); | - | ||||||||||||
41 | return executed 108 times by 2 tests: d->blockedEngines.keys();return d->blockedEngines.keys(); Executed by:
executed 108 times by 2 tests: return d->blockedEngines.keys(); Executed by:
| 108 | ||||||||||||
42 | } | - | ||||||||||||
43 | - | |||||||||||||
44 | void QQmlEngineControlClient::messageReceived(const QByteArray &data) | - | ||||||||||||
45 | { | - | ||||||||||||
46 | QQmlEngineControlClientPrivate * const d = d_func(); | - | ||||||||||||
47 | QPacket stream(d->connection->currentDataStreamVersion(), data); | - | ||||||||||||
48 | qint32 message; | - | ||||||||||||
49 | qint32 id; | - | ||||||||||||
50 | QString name; | - | ||||||||||||
51 | - | |||||||||||||
52 | stream >> message >> id; | - | ||||||||||||
53 | - | |||||||||||||
54 | if (!stream.atEnd()
| 0-92 | ||||||||||||
55 | stream >> name; never executed: stream >> name; | 0 | ||||||||||||
56 | - | |||||||||||||
57 | auto handleWaiting = [&]( | - | ||||||||||||
58 | QQmlEngineControlClientPrivate::CommandType command, std::function<void()> emitter) { | - | ||||||||||||
59 | QQmlEngineControlClientPrivate::EngineState &state = d->blockedEngines[id]; | - | ||||||||||||
60 | ((state.blockers == 0) ? static_cast<void>(0) : qt_assert("state.blockers == 0", __FILE__, 113)); | - | ||||||||||||
61 | ((state.releaseCommand == QQmlEngineControlClientPrivate::InvalidCommand) ? static_cast<void>(0) : qt_assert("state.releaseCommand == QQmlEngineControlClientPrivate::InvalidCommand", __FILE__, 114)); | - | ||||||||||||
62 | state.releaseCommand = command; | - | ||||||||||||
63 | emitter(); | - | ||||||||||||
64 | if (state.blockers == 0
| 16-30 | ||||||||||||
65 | d->sendCommand(state.releaseCommand, id); | - | ||||||||||||
66 | d->blockedEngines.remove(id); | - | ||||||||||||
67 | } executed 30 times by 1 test: end of block Executed by:
| 30 | ||||||||||||
68 | } executed 46 times by 2 tests: ;end of block Executed by:
| 46 | ||||||||||||
69 | - | |||||||||||||
70 | switch (message) { | - | ||||||||||||
71 | case executed 36 times by 2 tests: QQmlEngineControlClientPrivate::EngineAboutToBeAdded:case QQmlEngineControlClientPrivate::EngineAboutToBeAdded: Executed by:
executed 36 times by 2 tests: case QQmlEngineControlClientPrivate::EngineAboutToBeAdded: Executed by:
| 36 | ||||||||||||
72 | handleWaiting(QQmlEngineControlClientPrivate::StartWaitingEngine, [&](){ | - | ||||||||||||
73 | engineAboutToBeAdded(id, name); | - | ||||||||||||
74 | } executed 36 times by 2 tests: );end of block Executed by:
| 36 | ||||||||||||
75 | break; executed 36 times by 2 tests: break; Executed by:
| 36 | ||||||||||||
76 | case executed 36 times by 2 tests: QQmlEngineControlClientPrivate::EngineAdded:case QQmlEngineControlClientPrivate::EngineAdded: Executed by:
executed 36 times by 2 tests: case QQmlEngineControlClientPrivate::EngineAdded: Executed by:
| 36 | ||||||||||||
77 | engineAdded(id, name); | - | ||||||||||||
78 | break; executed 36 times by 2 tests: break; Executed by:
| 36 | ||||||||||||
79 | case executed 10 times by 2 tests: QQmlEngineControlClientPrivate::EngineAboutToBeRemoved:case QQmlEngineControlClientPrivate::EngineAboutToBeRemoved: Executed by:
executed 10 times by 2 tests: case QQmlEngineControlClientPrivate::EngineAboutToBeRemoved: Executed by:
| 10 | ||||||||||||
80 | handleWaiting(QQmlEngineControlClientPrivate::StopWaitingEngine, [&](){ | - | ||||||||||||
81 | engineAboutToBeRemoved(id, name); | - | ||||||||||||
82 | } executed 10 times by 2 tests: );end of block Executed by:
| 10 | ||||||||||||
83 | break; executed 10 times by 2 tests: break; Executed by:
| 10 | ||||||||||||
84 | case executed 10 times by 2 tests: QQmlEngineControlClientPrivate::EngineRemoved:case QQmlEngineControlClientPrivate::EngineRemoved: Executed by:
executed 10 times by 2 tests: case QQmlEngineControlClientPrivate::EngineRemoved: Executed by:
| 10 | ||||||||||||
85 | engineRemoved(id, name); | - | ||||||||||||
86 | break; executed 10 times by 2 tests: break; Executed by:
| 10 | ||||||||||||
87 | } | - | ||||||||||||
88 | } executed 92 times by 2 tests: end of block Executed by:
| 92 | ||||||||||||
89 | - | |||||||||||||
90 | QQmlEngineControlClientPrivate::QQmlEngineControlClientPrivate(QQmlDebugConnection *connection) : | - | ||||||||||||
91 | QQmlDebugClientPrivate(QLatin1String("EngineControl"), connection) | - | ||||||||||||
92 | { | - | ||||||||||||
93 | } executed 44 times by 2 tests: end of block Executed by:
| 44 | ||||||||||||
94 | - | |||||||||||||
95 | void QQmlEngineControlClientPrivate::sendCommand( | - | ||||||||||||
96 | QQmlEngineControlClientPrivate::CommandType command, int engineId) | - | ||||||||||||
97 | { | - | ||||||||||||
98 | QQmlEngineControlClient * const q = q_func(); | - | ||||||||||||
99 | QPacket stream(connection->currentDataStreamVersion()); | - | ||||||||||||
100 | stream << static_cast<qint32>(command) << engineId; | - | ||||||||||||
101 | q->sendMessage(stream.data()); | - | ||||||||||||
102 | } executed 46 times by 2 tests: end of block Executed by:
| 46 | ||||||||||||
103 | - | |||||||||||||
104 | - | |||||||||||||
105 | - | |||||||||||||
Switch to Source code | Preprocessed file |