diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2015-02-25 16:33:51 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-02-28 16:29:01 +0000 |
commit | 8d33af238e7b855bd5a217302e586d1dfe73066e (patch) | |
tree | 878cb85d034b18e982f60184d3d30072784c359e /src | |
parent | 66fc1e35db664ecaf0b37c855eea7391c0576773 (diff) |
QBackendNodeFunctor: get and destroy now take a QNodeId
This will help fixing the dynamic destruction in follow up patches.
Change-Id: Id44fbeac388628c0e563d288e13d1f15d7ac0c24
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
21 files changed, 69 insertions, 69 deletions
diff --git a/src/core/aspects/qabstractaspect.cpp b/src/core/aspects/qabstractaspect.cpp index ca8a543d6..82a1065f9 100644 --- a/src/core/aspects/qabstractaspect.cpp +++ b/src/core/aspects/qabstractaspect.cpp @@ -100,7 +100,7 @@ QBackendNode *QAbstractAspect::createBackendNode(QNode *frontend) const metaObj = metaObj->superClass(); } if (!functor.isNull()) { - QBackendNode *backend = functor->get(frontend); + QBackendNode *backend = functor->get(frontend->id()); if (backend != Q_NULLPTR) return backend; backend = functor->create(frontend, this); @@ -131,7 +131,7 @@ QBackendNode *QAbstractAspect::getBackendNode(QNode *frontend) const metaObj = metaObj->superClass(); } if (!functor.isNull()) - return functor->get(frontend); + return functor->get(frontend->id()); return Q_NULLPTR; } @@ -146,13 +146,13 @@ void QAbstractAspect::clearBackendNode(QNode *frontend) const metaObj = metaObj->superClass(); } if (!functor.isNull()) { - QBackendNode *backend = functor->get(frontend); + QBackendNode *backend = functor->get(frontend->id()); if (backend != Q_NULLPTR) { QBackendNodePrivate *backendPriv = QBackendNodePrivate::get(backend); d->m_arbiter->unregisterObserver(backendPriv, backend->peerUuid()); if (backend->mode() == QBackendNode::ReadWrite) d->m_arbiter->scene()->removeObservable(backendPriv, backend->peerUuid()); - functor->destroy(frontend); + functor->destroy(frontend->id()); } } } diff --git a/src/core/nodes/qbackendnode.h b/src/core/nodes/qbackendnode.h index 6b7950eb6..d37a902bb 100644 --- a/src/core/nodes/qbackendnode.h +++ b/src/core/nodes/qbackendnode.h @@ -55,8 +55,8 @@ class QT3DCORESHARED_EXPORT QBackendNodeFunctor public: virtual ~QBackendNodeFunctor() {} virtual QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const = 0; - virtual QBackendNode *get(QNode *frontend) const = 0; - virtual void destroy(QNode *frontend) const = 0; + virtual QBackendNode *get(const QNodeId &id) const = 0; + virtual void destroy(const QNodeId &id) const = 0; }; typedef QSharedPointer<QBackendNodeFunctor> QBackendNodeFunctorPtr; diff --git a/src/input/keyboardcontroller.cpp b/src/input/keyboardcontroller.cpp index b865d433c..0df458ed3 100644 --- a/src/input/keyboardcontroller.cpp +++ b/src/input/keyboardcontroller.cpp @@ -108,15 +108,15 @@ QBackendNode *KeyboardControllerFunctor::create(QNode *frontend, const QBackendN return controller; } -QBackendNode *KeyboardControllerFunctor::get(QNode *frontend) const +QBackendNode *KeyboardControllerFunctor::get(const QNodeId &id) const { - return m_handler->keyboardControllerManager()->lookupResource(frontend->id()); + return m_handler->keyboardControllerManager()->lookupResource(id); } -void KeyboardControllerFunctor::destroy(QNode *frontend) const +void KeyboardControllerFunctor::destroy(const QNodeId &id) const { - m_handler->removeKeyboardController(m_handler->keyboardControllerManager()->lookupHandle(frontend->id())); - m_handler->keyboardControllerManager()->releaseResource(frontend->id()); + m_handler->removeKeyboardController(m_handler->keyboardControllerManager()->lookupHandle(id)); + m_handler->keyboardControllerManager()->releaseResource(id); } } // Inputs diff --git a/src/input/keyboardcontroller_p.h b/src/input/keyboardcontroller_p.h index a10cb35f2..277b4b0be 100644 --- a/src/input/keyboardcontroller_p.h +++ b/src/input/keyboardcontroller_p.h @@ -84,8 +84,8 @@ public: explicit KeyboardControllerFunctor(InputHandler *handler); QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const Q_DECL_OVERRIDE; - QBackendNode *get(QNode *frontend) const Q_DECL_OVERRIDE; - void destroy(QNode *frontend) const Q_DECL_OVERRIDE; + QBackendNode *get(const QNodeId &id) const Q_DECL_OVERRIDE; + void destroy(const QNodeId &id) const Q_DECL_OVERRIDE; private: InputHandler *m_handler; diff --git a/src/input/keyboardinput.cpp b/src/input/keyboardinput.cpp index 1f0b80e5d..80e88b36d 100644 --- a/src/input/keyboardinput.cpp +++ b/src/input/keyboardinput.cpp @@ -157,14 +157,14 @@ QBackendNode *KeyboardInputFunctor::create(QNode *frontend, const QBackendNodeFa return input; } -QBackendNode *KeyboardInputFunctor::get(QNode *frontend) const +QBackendNode *KeyboardInputFunctor::get(const QNodeId &id) const { - return m_handler->keyboardInputManager()->lookupResource(frontend->id()); + return m_handler->keyboardInputManager()->lookupResource(id); } -void KeyboardInputFunctor::destroy(QNode *frontend) const +void KeyboardInputFunctor::destroy(const QNodeId &id) const { - m_handler->keyboardInputManager()->releaseResource(frontend->id()); + m_handler->keyboardInputManager()->releaseResource(id); } } // Input diff --git a/src/input/keyboardinput_p.h b/src/input/keyboardinput_p.h index d351b1dae..c4db79b12 100644 --- a/src/input/keyboardinput_p.h +++ b/src/input/keyboardinput_p.h @@ -81,8 +81,8 @@ public: explicit KeyboardInputFunctor(InputHandler *handler); QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const Q_DECL_OVERRIDE; - QBackendNode *get(QNode *frontend) const Q_DECL_OVERRIDE; - void destroy(QNode *frontend) const Q_DECL_OVERRIDE; + QBackendNode *get(const QNodeId &id) const Q_DECL_OVERRIDE; + void destroy(const QNodeId &id) const Q_DECL_OVERRIDE; private: InputHandler *m_handler; diff --git a/src/render/backend/framegraph/framegraphnode.cpp b/src/render/backend/framegraph/framegraphnode.cpp index 0ca5c9965..8742399ed 100644 --- a/src/render/backend/framegraph/framegraphnode.cpp +++ b/src/render/backend/framegraph/framegraphnode.cpp @@ -149,15 +149,15 @@ QBackendNode *FrameGraphComponentFunctor::create(QNode *frontend, const QBackend return Q_NULLPTR; } -QBackendNode *FrameGraphComponentFunctor::get(QNode *frontend) const +QBackendNode *FrameGraphComponentFunctor::get(const QNodeId &id) const { - Q_UNUSED(frontend); + Q_UNUSED(id); return Q_NULLPTR; } -void FrameGraphComponentFunctor::destroy(QNode *frontend) const +void FrameGraphComponentFunctor::destroy(const QNodeId &id) const { - Q_UNUSED(frontend); + Q_UNUSED(id); } } // namespace Render diff --git a/src/render/backend/framegraph/framegraphnode_p.h b/src/render/backend/framegraph/framegraphnode_p.h index 6555ba778..a36857ce2 100644 --- a/src/render/backend/framegraph/framegraphnode_p.h +++ b/src/render/backend/framegraph/framegraphnode_p.h @@ -116,17 +116,17 @@ public: return createBackendFrameGraphNode(frontend, factory); } - QBackendNode *get(QNode *frontend) const Q_DECL_OVERRIDE + QBackendNode *get(const QNodeId &id) const Q_DECL_OVERRIDE { - FrameGraphNode **node = m_manager->lookupResource(frontend->id()); + FrameGraphNode **node = m_manager->lookupResource(id); if (node != Q_NULLPTR) return *node; return Q_NULLPTR; } - void destroy(QNode *frontend) const Q_DECL_OVERRIDE + void destroy(const QNodeId &id) const Q_DECL_OVERRIDE { - m_manager->releaseResource(frontend->id()); + m_manager->releaseResource(id); } protected: @@ -161,8 +161,8 @@ class FrameGraphComponentFunctor : public QBackendNodeFunctor public: explicit FrameGraphComponentFunctor(Renderer *renderer); QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const Q_DECL_OVERRIDE; - QBackendNode *get(QNode *frontend) const Q_DECL_OVERRIDE; - void destroy(QNode *frontend) const Q_DECL_OVERRIDE; + QBackendNode *get(const QNodeId &id) const Q_DECL_OVERRIDE; + void destroy(const QNodeId &id) const Q_DECL_OVERRIDE; private: Renderer *m_renderer; diff --git a/src/render/backend/renderentity.cpp b/src/render/backend/renderentity.cpp index 9a8aec605..dbc39c40f 100644 --- a/src/render/backend/renderentity.cpp +++ b/src/render/backend/renderentity.cpp @@ -385,14 +385,14 @@ QBackendNode *RenderEntityFunctor::create(QNode *frontend, const QBackendNodeFac return entity; } -QBackendNode *RenderEntityFunctor::get(QNode *frontend) const +QBackendNode *RenderEntityFunctor::get(const QNodeId &id) const { - return m_renderer->renderNodesManager()->lookupResource(frontend->id()); + return m_renderer->renderNodesManager()->lookupResource(id); } -void RenderEntityFunctor::destroy(QNode *frontend) const +void RenderEntityFunctor::destroy(const QNodeId &id) const { - m_renderer->renderNodesManager()->releaseResource(frontend->id()); + m_renderer->renderNodesManager()->releaseResource(id); } } // namespace Render diff --git a/src/render/backend/renderentity_p.h b/src/render/backend/renderentity_p.h index 686c6b0a0..5b835468e 100644 --- a/src/render/backend/renderentity_p.h +++ b/src/render/backend/renderentity_p.h @@ -221,8 +221,8 @@ class RenderEntityFunctor : public QBackendNodeFunctor public: explicit RenderEntityFunctor(Renderer *renderer); QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const Q_DECL_OVERRIDE; - QBackendNode *get(QNode *frontend) const Q_DECL_OVERRIDE; - void destroy(QNode *frontend) const Q_DECL_OVERRIDE; + QBackendNode *get(const QNodeId &id) const Q_DECL_OVERRIDE; + void destroy(const QNodeId &id) const Q_DECL_OVERRIDE; private: Renderer *m_renderer; diff --git a/src/render/backend/rendermesh.cpp b/src/render/backend/rendermesh.cpp index 1f05c6cf2..1fcd65dd4 100644 --- a/src/render/backend/rendermesh.cpp +++ b/src/render/backend/rendermesh.cpp @@ -151,14 +151,14 @@ QBackendNode *RenderMeshCreatorFunctor::create(QNode *frontend, const QBackendNo return mesh; } -QBackendNode *RenderMeshCreatorFunctor::get(QNode *frontend) const +QBackendNode *RenderMeshCreatorFunctor::get(const QNodeId &id) const { - return m_meshManager->lookupResource(frontend->id()); + return m_meshManager->lookupResource(id); } -void RenderMeshCreatorFunctor::destroy(QNode *frontend) const +void RenderMeshCreatorFunctor::destroy(const QNodeId &id) const { - m_meshManager->releaseResource(frontend->id()); + m_meshManager->releaseResource(id); } } // Render diff --git a/src/render/backend/rendermesh_p.h b/src/render/backend/rendermesh_p.h index cfd797976..0a7f5e1fc 100644 --- a/src/render/backend/rendermesh_p.h +++ b/src/render/backend/rendermesh_p.h @@ -96,8 +96,8 @@ class RenderMeshCreatorFunctor : public QBackendNodeFunctor public: explicit RenderMeshCreatorFunctor(MeshManager *meshManager, MeshDataManager *meshDataManager); QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const Q_DECL_OVERRIDE; - QBackendNode *get(QNode *frontend) const Q_DECL_OVERRIDE; - void destroy(QNode *frontend) const Q_DECL_OVERRIDE; + QBackendNode *get(const QNodeId &id) const Q_DECL_OVERRIDE; + void destroy(const QNodeId &id) const Q_DECL_OVERRIDE; private: MeshManager *m_meshManager; diff --git a/src/render/backend/rendernodefunctor_p.h b/src/render/backend/rendernodefunctor_p.h index 30e6e2d7f..1670336e0 100644 --- a/src/render/backend/rendernodefunctor_p.h +++ b/src/render/backend/rendernodefunctor_p.h @@ -63,14 +63,14 @@ public: return backend; } - QBackendNode *get(QNode *frontend) const Q_DECL_FINAL + QBackendNode *get(const QNodeId &id) const Q_DECL_FINAL { - return m_manager->lookupResource(frontend->id()); + return m_manager->lookupResource(id); } - void destroy(QNode *frontend) const Q_DECL_FINAL + void destroy(const QNodeId &id) const Q_DECL_FINAL { - m_manager->releaseResource(frontend->id()); + m_manager->releaseResource(id); } private: diff --git a/src/render/backend/renderscene.cpp b/src/render/backend/renderscene.cpp index d653b80ae..ffd779e39 100644 --- a/src/render/backend/renderscene.cpp +++ b/src/render/backend/renderscene.cpp @@ -112,14 +112,14 @@ QBackendNode *RenderSceneFunctor::create(QNode *frontend, const QBackendNodeFact return scene; } -QBackendNode *RenderSceneFunctor::get(QNode *frontend) const +QBackendNode *RenderSceneFunctor::get(const QNodeId &id) const { - return m_sceneManager->lookupResource(frontend->id()); + return m_sceneManager->lookupResource(id); } -void RenderSceneFunctor::destroy(QNode *frontend) const +void RenderSceneFunctor::destroy(const QNodeId &id) const { - m_sceneManager->releaseResource(frontend->id()); + m_sceneManager->releaseResource(id); } } // Render diff --git a/src/render/backend/renderscene_p.h b/src/render/backend/renderscene_p.h index 4f7d12c06..49cf8bbdb 100644 --- a/src/render/backend/renderscene_p.h +++ b/src/render/backend/renderscene_p.h @@ -74,8 +74,8 @@ class RenderSceneFunctor : public QBackendNodeFunctor public: explicit RenderSceneFunctor(SceneManager *sceneManager); QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const Q_DECL_OVERRIDE; - QBackendNode *get(QNode *frontend) const Q_DECL_OVERRIDE; - void destroy(QNode *frontend) const Q_DECL_OVERRIDE; + QBackendNode *get(const QNodeId &id) const Q_DECL_OVERRIDE; + void destroy(const QNodeId &id) const Q_DECL_OVERRIDE; private: SceneManager *m_sceneManager; diff --git a/src/render/backend/rendershaderdata.cpp b/src/render/backend/rendershaderdata.cpp index e13dc51f6..5ed42ce2a 100644 --- a/src/render/backend/rendershaderdata.cpp +++ b/src/render/backend/rendershaderdata.cpp @@ -298,14 +298,14 @@ QBackendNode *RenderShaderDataFunctor::create(QNode *frontend, const QBackendNod return backend; } -QBackendNode *RenderShaderDataFunctor::get(QNode *frontend) const +QBackendNode *RenderShaderDataFunctor::get(const QNodeId &id) const { - return m_manager->lookupResource(frontend->id()); + return m_manager->lookupResource(id); } -void RenderShaderDataFunctor::destroy(QNode *frontend) const +void RenderShaderDataFunctor::destroy(const QNodeId &id) const { - m_manager->releaseResource(frontend->id()); + m_manager->releaseResource(id); } } // Render diff --git a/src/render/backend/rendershaderdata_p.h b/src/render/backend/rendershaderdata_p.h index b1ea6e25b..a88bd729b 100644 --- a/src/render/backend/rendershaderdata_p.h +++ b/src/render/backend/rendershaderdata_p.h @@ -107,8 +107,8 @@ public: explicit RenderShaderDataFunctor(ShaderDataManager *manager); QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const Q_DECL_FINAL; - QBackendNode *get(QNode *frontend) const Q_DECL_FINAL; - void destroy(QNode *frontend) const Q_DECL_FINAL; + QBackendNode *get(const QNodeId &id) const Q_DECL_FINAL; + void destroy(const QNodeId &id) const Q_DECL_FINAL; private: ShaderDataManager *m_manager; diff --git a/src/render/backend/rendertexture.cpp b/src/render/backend/rendertexture.cpp index c973afcc8..4e9d7e2c0 100644 --- a/src/render/backend/rendertexture.cpp +++ b/src/render/backend/rendertexture.cpp @@ -554,14 +554,14 @@ QBackendNode *RenderTextureFunctor::create(QNode *frontend, const QBackendNodeFa return backend; } -QBackendNode *RenderTextureFunctor::get(QNode *frontend) const +QBackendNode *RenderTextureFunctor::get(const QNodeId &id) const { - return m_textureManager->lookupResource(frontend->id()); + return m_textureManager->lookupResource(id); } -void RenderTextureFunctor::destroy(QNode *frontend) const +void RenderTextureFunctor::destroy(const QNodeId &id) const { - m_textureManager->releaseResource(frontend->id()); + m_textureManager->releaseResource(id); } } // namespace Render diff --git a/src/render/backend/rendertexture_p.h b/src/render/backend/rendertexture_p.h index 0f7379ee3..d5bc1514d 100644 --- a/src/render/backend/rendertexture_p.h +++ b/src/render/backend/rendertexture_p.h @@ -141,8 +141,8 @@ public: TextureDataManager *textureDataManager); QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const Q_DECL_FINAL; - QBackendNode *get(QNode *frontend) const Q_DECL_FINAL; - void destroy(QNode *frontend) const Q_DECL_FINAL; + QBackendNode *get(const QNodeId &id) const Q_DECL_FINAL; + void destroy(const QNodeId &id) const Q_DECL_FINAL; private: TextureManager *m_textureManager; diff --git a/src/render/backend/rendertextureimage.cpp b/src/render/backend/rendertextureimage.cpp index b881d1a44..0a24e4e71 100644 --- a/src/render/backend/rendertextureimage.cpp +++ b/src/render/backend/rendertextureimage.cpp @@ -171,14 +171,14 @@ QBackendNode *RenderTextureImageFunctor::create(QNode *frontend, const QBackendN return backend; } -QBackendNode *RenderTextureImageFunctor::get(QNode *frontend) const +QBackendNode *RenderTextureImageFunctor::get(const QNodeId &id) const { - return m_textureImageManager->lookupResource(frontend->id()); + return m_textureImageManager->lookupResource(id); } -void RenderTextureImageFunctor::destroy(QNode *frontend) const +void RenderTextureImageFunctor::destroy(const QNodeId &id) const { - m_textureImageManager->releaseResource(frontend->id()); + m_textureImageManager->releaseResource(id); } } // Render diff --git a/src/render/backend/rendertextureimage_p.h b/src/render/backend/rendertextureimage_p.h index 99ff893a9..d9aa9c09a 100644 --- a/src/render/backend/rendertextureimage_p.h +++ b/src/render/backend/rendertextureimage_p.h @@ -108,8 +108,8 @@ public: TextureDataManager *textureDataManager); QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const Q_DECL_FINAL; - QBackendNode *get(QNode *frontend) const Q_DECL_FINAL; - void destroy(QNode *frontend) const Q_DECL_FINAL; + QBackendNode *get(const QNodeId &id) const Q_DECL_FINAL; + void destroy(const QNodeId &id) const Q_DECL_FINAL; private: TextureManager *m_textureManager; |