* @brief Shared per-frame scaffolding (capture flag, engine cache, watchdog arm, storage pin); * returns true when the JS watchdog was armed (forwarded to endDatasetPass). */
| 1384 | * returns true when the JS watchdog was armed (forwarded to endDatasetPass). |
| 1385 | */ |
| 1386 | bool DataModel::FrameBuilder::beginDatasetPass(const TransformFrameInfo& info) |
| 1387 | { |
| 1388 | static auto& parser = DataModel::FrameParser::instance(); |
| 1389 | const int epoch = parser.engineEpoch(); |
| 1390 | if (m_captureFlagsDirty || epoch != m_seenEngineEpoch) [[unlikely]] { |
| 1391 | m_seenEngineEpoch = epoch; |
| 1392 | refreshDatasetCaptureFlag(); |
| 1393 | } |
| 1394 | |
| 1395 | if (info.sourceId != m_engineCacheSourceId) [[unlikely]] { |
| 1396 | m_engineCacheSourceId = info.sourceId; |
| 1397 | auto luaIt = m_transformEngines.find({info.sourceId, SerialStudio::Lua}); |
| 1398 | auto jsIt = m_transformEngines.find({info.sourceId, SerialStudio::JavaScript}); |
| 1399 | m_luaEngineForSource = (luaIt != m_transformEngines.end()) ? &luaIt->second : nullptr; |
| 1400 | m_jsEngineForSource = (jsIt != m_transformEngines.end()) ? &jsIt->second : nullptr; |
| 1401 | } |
| 1402 | |
| 1403 | const bool armJsWatchdog = (m_jsEngineForSource != nullptr); |
| 1404 | if (armJsWatchdog) [[unlikely]] { |
| 1405 | Q_ASSERT(m_jsEngineForSource->jsWatchdog); |
| 1406 | m_jsTransformTimedOut = false; |
| 1407 | m_jsEngineForSource->jsWatchdog->arm(); |
| 1408 | } |
| 1409 | |
| 1410 | ++m_compileGuard; |
| 1411 | return armJsWatchdog; |
| 1412 | } |
| 1413 | |
| 1414 | /** |
| 1415 | * @brief Releases the dataset-pass scaffolding: unpins engine storage, disarms the watchdog and |
nothing calls this directly
no test coverage detected