| 1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QT3DCORE_QASPECTJOBMANAGER_P_H |
| 5 | #define QT3DCORE_QASPECTJOBMANAGER_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of other Qt classes. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <Qt3DCore/qaspectjob.h> |
| 19 | |
| 20 | #include <Qt3DCore/private/qabstractaspectjobmanager_p.h> |
| 21 | #include <Qt3DCore/private/qt3dcore_global_p.h> |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | namespace Qt3DCore { |
| 26 | |
| 27 | class QThreadPooler; |
| 28 | class DependencyHandler; |
| 29 | class QAspectManager; |
| 30 | |
| 31 | class Q_3DCORE_PRIVATE_EXPORT QAspectJobManager : public QAbstractAspectJobManager |
| 32 | { |
| 33 | Q_OBJECT |
| 34 | public: |
| 35 | explicit QAspectJobManager(QAspectManager *parent = nullptr); |
| 36 | ~QAspectJobManager(); |
| 37 | |
| 38 | void initialize() override; |
| 39 | |
| 40 | void enqueueJobs(const std::vector<QAspectJobPtr> &jobQueue) override; |
| 41 | |
| 42 | int waitForAllJobs() override; |
| 43 | |
| 44 | void waitForPerThreadFunction(JobFunction func, void *arg) override; |
| 45 | static int idealThreadCount(); |
| 46 | |
| 47 | private: |
| 48 | QThreadPooler *m_threadPooler; |
| 49 | QAspectManager *m_aspectManager; |
| 50 | }; |
| 51 | |
| 52 | } // namespace Qt3DCore |
| 53 | |
| 54 | QT_END_NAMESPACE |
| 55 | |
| 56 | #endif // QT3DCORE_QASPECTJOBMANAGER_P_H |
| 57 | |