diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2019-08-07 16:52:00 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2019-08-13 11:52:25 +0300 |
commit | 7ea21a4315b1c6df104d80a700680dd1f9d204dc (patch) | |
tree | 8b5dca8ca23a2acdab6f8ad1f911faad1fdb1ddc /src/uipparser | |
parent | d2a1092b93e9669288dc1d5825bfec849bec9f95 (diff) |
Make runtime initialization optionally not block QML
Runtime initialization made non-blocking by offloading it to a worker
thread. This causes various object thread affinities in runtime
to be incorrect. This is relevant at least for the singaling,
where having affinity to non-existing initialization thread would
cause signals to not be delivered.
To work around this issue, signal proxy thread affinitions and
signal connections are set after initialization has completed.
Similarly, behavior script QML engine initialization is deferred
so that it can be done in correct thread.
Task-number: QT3DS-3805
Change-Id: Ie8b64f4ecd93e4c422e369e625080652d67bde27
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/uipparser')
-rw-r--r-- | src/uipparser/Qt3DSUIPParser.h | 3 | ||||
-rw-r--r-- | src/uipparser/Qt3DSUIPParserImpl.cpp | 17 | ||||
-rw-r--r-- | src/uipparser/Qt3DSUIPParserImpl.h | 9 |
3 files changed, 18 insertions, 11 deletions
diff --git a/src/uipparser/Qt3DSUIPParser.h b/src/uipparser/Qt3DSUIPParser.h index 6657139..7b4fc3f 100644 --- a/src/uipparser/Qt3DSUIPParser.h +++ b/src/uipparser/Qt3DSUIPParser.h @@ -131,7 +131,8 @@ protected: virtual ~IUIPParser() {} public: // Parse UIP file virtual BOOL Load(IPresentation &inPresentation, - NVConstDataRef<SElementAttributeReference> inStateReferences) = 0; + NVConstDataRef<SElementAttributeReference> inStateReferences, + bool initInRenderThread) = 0; virtual qt3dsdm::IDOMReader &GetDOMReader() = 0; virtual IRuntimeMetaData &GetMetaData() = 0; // Mapping back from file id to element id, needed to hook elements up to their respective diff --git a/src/uipparser/Qt3DSUIPParserImpl.cpp b/src/uipparser/Qt3DSUIPParserImpl.cpp index a2f3c7c..b899248 100644 --- a/src/uipparser/Qt3DSUIPParserImpl.cpp +++ b/src/uipparser/Qt3DSUIPParserImpl.cpp @@ -514,7 +514,8 @@ CUIPParserImpl::~CUIPParserImpl() * @return a flag indicating whether or not we successfully loaded the file */ BOOL CUIPParserImpl::Load(IPresentation &inPresentation, - NVConstDataRef<SElementAttributeReference> inStateReferences) + NVConstDataRef<SElementAttributeReference> inStateReferences, + bool initInRenderThread) { m_CurrentPresentation = &inPresentation; if (!m_DOMReader) { @@ -582,7 +583,7 @@ BOOL CUIPParserImpl::Load(IPresentation &inPresentation, // Now we are ready to load the scene graph if (theLoadResult) - theLoadResult &= LoadGraph(inPresentation, *m_DOMReader); + theLoadResult &= LoadGraph(inPresentation, *m_DOMReader, initInRenderThread); if (theLoadResult) theLoadResult &= LoadLogic(inPresentation, *m_DOMReader); @@ -673,7 +674,8 @@ BOOL CUIPParserImpl::LoadClasses(IPresentation & /*inPresentation*/, IDOMReader return true; } -BOOL CUIPParserImpl::LoadGraph(IPresentation &inPresentation, qt3dsdm::IDOMReader &inReader) +BOOL CUIPParserImpl::LoadGraph(IPresentation &inPresentation, qt3dsdm::IDOMReader &inReader, + bool initInRenderThread) { IDOMReader::Scope __childScope(inReader); @@ -683,7 +685,7 @@ BOOL CUIPParserImpl::LoadGraph(IPresentation &inPresentation, qt3dsdm::IDOMReade bool theLoadResult = inReader.MoveToFirstChild("Graph"); if (theLoadResult) { - theLoadResult &= LoadSceneGraph(inPresentation, inReader); + theLoadResult &= LoadSceneGraph(inPresentation, inReader, nullptr, initInRenderThread); if (theLoadResult) PatchSceneElementRef(); } @@ -1009,7 +1011,8 @@ EElementType GetElementType(const char *inType) * @return a flag indicating whether or not we successfully loaded the file */ BOOL CUIPParserImpl::LoadSceneGraph(IPresentation &inPresentation, IDOMReader &inReader, - qt3ds::runtime::element::SElement *inNewStyleParent) + qt3ds::runtime::element::SElement *inNewStyleParent, + bool initInRenderThread) { IDOMReader::Scope __childScope(inReader); IScriptBridge *theScriptBridgeQml = inPresentation.GetScriptBridgeQml(); @@ -1141,10 +1144,10 @@ BOOL CUIPParserImpl::LoadSceneGraph(IPresentation &inPresentation, IDOMReader &i if (isBehavior) { if (theFileString.find(".qml") != eastl::string::npos) { theScriptBridgeQml->LoadScript(&inPresentation, &theNewElem, - theFileString.c_str()); + theFileString.c_str(), initInRenderThread); } } - LoadSceneGraph(inPresentation, inReader, &theNewElem); + LoadSceneGraph(inPresentation, inReader, &theNewElem, initInRenderThread); } return true; diff --git a/src/uipparser/Qt3DSUIPParserImpl.h b/src/uipparser/Qt3DSUIPParserImpl.h index bca984b..3c44e21 100644 --- a/src/uipparser/Qt3DSUIPParserImpl.h +++ b/src/uipparser/Qt3DSUIPParserImpl.h @@ -527,7 +527,8 @@ public: // Construction public: // Parse UIP file BOOL Load(IPresentation &inPresentation, - NVConstDataRef<SElementAttributeReference> inStateReferences) override; + NVConstDataRef<SElementAttributeReference> inStateReferences, + bool initInRenderThread) override; qt3dsdm::IDOMReader &GetDOMReader() override; IRuntimeMetaData &GetMetaData() override; SElementAndType GetElementForID(const char *inStringId) override; @@ -549,9 +550,11 @@ public: // Parse UIP file protected: // Operation BOOL LoadProjectSettings(IPresentation &inPresentation, qt3dsdm::IDOMReader &inReader); BOOL LoadClasses(IPresentation &inPresentation, qt3dsdm::IDOMReader &inReader); - BOOL LoadGraph(IPresentation &inPresentation, qt3dsdm::IDOMReader &inReader); + BOOL LoadGraph(IPresentation &inPresentation, qt3dsdm::IDOMReader &inReader, + bool initInRenderThread); BOOL LoadSceneGraph(IPresentation &inPresentation, qt3dsdm::IDOMReader &inReader, - qt3ds::runtime::element::SElement *inNewStyleParent = NULL); + qt3ds::runtime::element::SElement *inNewStyleParent, + bool initInRenderThread); BOOL LoadLogic(IPresentation &inPresentation, qt3dsdm::IDOMReader &inReader); BOOL LoadStateGraph(IPresentation &inPresentation, qt3dsdm::IDOMReader &inReader); |