Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlengine_p.h |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||
2 | ** | - | ||||||||||||
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||
4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||
5 | ** | - | ||||||||||||
6 | ** This file is part of the QtQml module of the Qt Toolkit. | - | ||||||||||||
7 | ** | - | ||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||
15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||
16 | ** | - | ||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||
24 | ** | - | ||||||||||||
25 | ** GNU General Public License Usage | - | ||||||||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||
35 | ** | - | ||||||||||||
36 | ** $QT_END_LICENSE$ | - | ||||||||||||
37 | ** | - | ||||||||||||
38 | ****************************************************************************/ | - | ||||||||||||
39 | - | |||||||||||||
40 | #ifndef QQMLENGINE_P_H | - | ||||||||||||
41 | #define QQMLENGINE_P_H | - | ||||||||||||
42 | - | |||||||||||||
43 | // | - | ||||||||||||
44 | // W A R N I N G | - | ||||||||||||
45 | // ------------- | - | ||||||||||||
46 | // | - | ||||||||||||
47 | // This file is not part of the Qt API. It exists purely as an | - | ||||||||||||
48 | // implementation detail. This header file may change from version to | - | ||||||||||||
49 | // version without notice, or even be removed. | - | ||||||||||||
50 | // | - | ||||||||||||
51 | // We mean it. | - | ||||||||||||
52 | // | - | ||||||||||||
53 | - | |||||||||||||
54 | #include "qqmlengine.h" | - | ||||||||||||
55 | - | |||||||||||||
56 | #include "qqmltypeloader_p.h" | - | ||||||||||||
57 | #include "qqmlimport_p.h" | - | ||||||||||||
58 | #include <private/qpodvector_p.h> | - | ||||||||||||
59 | #include "qqml.h" | - | ||||||||||||
60 | #include "qqmlvaluetype_p.h" | - | ||||||||||||
61 | #include "qqmlcontext.h" | - | ||||||||||||
62 | #include "qqmlcontext_p.h" | - | ||||||||||||
63 | #include "qqmlexpression.h" | - | ||||||||||||
64 | #include "qqmlproperty_p.h" | - | ||||||||||||
65 | #include "qqmlpropertycache_p.h" | - | ||||||||||||
66 | #include "qqmlmetatype_p.h" | - | ||||||||||||
67 | #include "qqmldirparser_p.h" | - | ||||||||||||
68 | #include <private/qintrusivelist_p.h> | - | ||||||||||||
69 | #include <private/qrecyclepool_p.h> | - | ||||||||||||
70 | #include <private/qfieldlist_p.h> | - | ||||||||||||
71 | - | |||||||||||||
72 | #include <QtCore/qlist.h> | - | ||||||||||||
73 | #include <QtCore/qpair.h> | - | ||||||||||||
74 | #include <QtCore/qstack.h> | - | ||||||||||||
75 | #include <QtCore/qmutex.h> | - | ||||||||||||
76 | #include <QtCore/qstring.h> | - | ||||||||||||
77 | #include <QtCore/qthread.h> | - | ||||||||||||
78 | - | |||||||||||||
79 | #include <private/qobject_p.h> | - | ||||||||||||
80 | - | |||||||||||||
81 | #include <private/qv8engine_p.h> | - | ||||||||||||
82 | #include <private/qjsengine_p.h> | - | ||||||||||||
83 | - | |||||||||||||
84 | QT_BEGIN_NAMESPACE | - | ||||||||||||
85 | - | |||||||||||||
86 | class QQmlContext; | - | ||||||||||||
87 | class QQmlEngine; | - | ||||||||||||
88 | class QQmlContextPrivate; | - | ||||||||||||
89 | class QQmlExpression; | - | ||||||||||||
90 | class QQmlImportDatabase; | - | ||||||||||||
91 | class QNetworkReply; | - | ||||||||||||
92 | class QNetworkAccessManager; | - | ||||||||||||
93 | class QQmlNetworkAccessManagerFactory; | - | ||||||||||||
94 | class QQmlTypeNameCache; | - | ||||||||||||
95 | class QQmlComponentAttached; | - | ||||||||||||
96 | class QQmlCleanup; | - | ||||||||||||
97 | class QQmlDelayedError; | - | ||||||||||||
98 | class QQuickWorkerScriptEngine; | - | ||||||||||||
99 | class QQmlObjectCreator; | - | ||||||||||||
100 | class QDir; | - | ||||||||||||
101 | class QQmlIncubator; | - | ||||||||||||
102 | class QQmlProfiler; | - | ||||||||||||
103 | class QQmlPropertyCapture; | - | ||||||||||||
104 | - | |||||||||||||
105 | // This needs to be declared here so that the pool for it can live in QQmlEnginePrivate. | - | ||||||||||||
106 | // The inline method definitions are in qqmljavascriptexpression_p.h | - | ||||||||||||
107 | class QQmlJavaScriptExpressionGuard : public QQmlNotifierEndpoint | - | ||||||||||||
108 | { | - | ||||||||||||
109 | public: | - | ||||||||||||
110 | inline QQmlJavaScriptExpressionGuard(QQmlJavaScriptExpression *); | - | ||||||||||||
111 | - | |||||||||||||
112 | static inline QQmlJavaScriptExpressionGuard *New(QQmlJavaScriptExpression *e, | - | ||||||||||||
113 | QQmlEngine *engine); | - | ||||||||||||
114 | inline void Delete(); | - | ||||||||||||
115 | - | |||||||||||||
116 | QQmlJavaScriptExpression *expression; | - | ||||||||||||
117 | QQmlJavaScriptExpressionGuard *next; | - | ||||||||||||
118 | }; | - | ||||||||||||
119 | - | |||||||||||||
120 | class Q_QML_PRIVATE_EXPORT QQmlEnginePrivate : public QJSEnginePrivate | - | ||||||||||||
121 | { | - | ||||||||||||
122 | Q_DECLARE_PUBLIC(QQmlEngine) | - | ||||||||||||
123 | public: | - | ||||||||||||
124 | QQmlEnginePrivate(QQmlEngine *); | - | ||||||||||||
125 | ~QQmlEnginePrivate() override; | - | ||||||||||||
126 | - | |||||||||||||
127 | void init(); | - | ||||||||||||
128 | // No mutex protecting baseModulesUninitialized, because use outside QQmlEngine | - | ||||||||||||
129 | // is just qmlClearTypeRegistrations (which can't be called while an engine exists) | - | ||||||||||||
130 | static bool baseModulesUninitialized; | - | ||||||||||||
131 | - | |||||||||||||
132 | QQmlPropertyCapture *propertyCapture; | - | ||||||||||||
133 | - | |||||||||||||
134 | QRecyclePool<QQmlJavaScriptExpressionGuard> jsExpressionGuardPool; | - | ||||||||||||
135 | - | |||||||||||||
136 | QQmlContext *rootContext; | - | ||||||||||||
137 | - | |||||||||||||
138 | #if !QT_CONFIG(qml_debug) | - | ||||||||||||
139 | static const quintptr profiler = 0; | - | ||||||||||||
140 | #else | - | ||||||||||||
141 | QQmlProfiler *profiler; | - | ||||||||||||
142 | #endif | - | ||||||||||||
143 | - | |||||||||||||
144 | bool outputWarningsToMsgLog; | - | ||||||||||||
145 | - | |||||||||||||
146 | // Registered cleanup handlers | - | ||||||||||||
147 | QQmlCleanup *cleanup; | - | ||||||||||||
148 | - | |||||||||||||
149 | // Bindings that have had errors during startup | - | ||||||||||||
150 | QQmlDelayedError *erroredBindings; | - | ||||||||||||
151 | int inProgressCreations; | - | ||||||||||||
152 | - | |||||||||||||
153 | QV8Engine *v8engine() const { return q_func()->handle()->v8Engine; } executed 96928 times by 142 tests: return q_func()->handle()->v8Engine; Executed by:
| 96928 | ||||||||||||
154 | QV4::ExecutionEngine *v4engine() const { return q_func()->handle(); } executed 2123097 times by 140 tests: return q_func()->handle(); Executed by:
| 2123097 | ||||||||||||
155 | - | |||||||||||||
156 | QQuickWorkerScriptEngine *getWorkerScriptEngine(); | - | ||||||||||||
157 | QQuickWorkerScriptEngine *workerScriptEngine; | - | ||||||||||||
158 | - | |||||||||||||
159 | QUrl baseUrl; | - | ||||||||||||
160 | - | |||||||||||||
161 | typedef QPair<QPointer<QObject>,int> FinalizeCallback; | - | ||||||||||||
162 | void registerFinalizeCallback(QObject *obj, int index); | - | ||||||||||||
163 | - | |||||||||||||
164 | QQmlObjectCreator *activeObjectCreator; | - | ||||||||||||
165 | #if QT_CONFIG(qml_network) | - | ||||||||||||
166 | QNetworkAccessManager *createNetworkAccessManager(QObject *parent) const; | - | ||||||||||||
167 | QNetworkAccessManager *getNetworkAccessManager() const; | - | ||||||||||||
168 | mutable QNetworkAccessManager *networkAccessManager; | - | ||||||||||||
169 | mutable QQmlNetworkAccessManagerFactory *networkAccessManagerFactory; | - | ||||||||||||
170 | #endif | - | ||||||||||||
171 | QHash<QString,QSharedPointer<QQmlImageProviderBase> > imageProviders; | - | ||||||||||||
172 | - | |||||||||||||
173 | QQmlAbstractUrlInterceptor* urlInterceptor; | - | ||||||||||||
174 | - | |||||||||||||
175 | int scarceResourcesRefCount; | - | ||||||||||||
176 | void referenceScarceResources(); | - | ||||||||||||
177 | void dereferenceScarceResources(); | - | ||||||||||||
178 | - | |||||||||||||
179 | QQmlImportDatabase importDatabase; | - | ||||||||||||
180 | QQmlTypeLoader typeLoader; | - | ||||||||||||
181 | - | |||||||||||||
182 | QString offlineStoragePath; | - | ||||||||||||
183 | - | |||||||||||||
184 | mutable quint32 uniqueId; | - | ||||||||||||
185 | inline quint32 getUniqueId() const { | - | ||||||||||||
186 | return uniqueId++; never executed: return uniqueId++; | 0 | ||||||||||||
187 | } | - | ||||||||||||
188 | - | |||||||||||||
189 | // Unfortunate workaround to avoid a circular dependency between | - | ||||||||||||
190 | // qqmlengine_p.h and qqmlincubator_p.h | - | ||||||||||||
191 | struct Incubator : public QSharedData { | - | ||||||||||||
192 | QIntrusiveListNode next; | - | ||||||||||||
193 | // Unfortunate workaround for MSVC | - | ||||||||||||
194 | QIntrusiveListNode nextWaitingFor; | - | ||||||||||||
195 | }; | - | ||||||||||||
196 | QIntrusiveList<Incubator, &Incubator::next> incubatorList; | - | ||||||||||||
197 | unsigned int incubatorCount; | - | ||||||||||||
198 | QQmlIncubationController *incubationController; | - | ||||||||||||
199 | void incubate(QQmlIncubator &, QQmlContextData *); | - | ||||||||||||
200 | - | |||||||||||||
201 | // These methods may be called from any thread | - | ||||||||||||
202 | inline bool isEngineThread() const; | - | ||||||||||||
203 | inline static bool isEngineThread(const QQmlEngine *); | - | ||||||||||||
204 | template<typename T> | - | ||||||||||||
205 | inline void deleteInEngineThread(T *); | - | ||||||||||||
206 | template<typename T> | - | ||||||||||||
207 | inline static void deleteInEngineThread(QQmlEnginePrivate *, T *); | - | ||||||||||||
208 | QString offlineStorageDatabaseDirectory() const; | - | ||||||||||||
209 | - | |||||||||||||
210 | // These methods may be called from the loader thread | - | ||||||||||||
211 | inline QQmlPropertyCache *cache(const QQmlType &, int); | - | ||||||||||||
212 | using QJSEnginePrivate::cache; | - | ||||||||||||
213 | - | |||||||||||||
214 | // These methods may be called from the loader thread | - | ||||||||||||
215 | bool isQObject(int); | - | ||||||||||||
216 | QObject *toQObject(const QVariant &, bool *ok = nullptr) const; | - | ||||||||||||
217 | QQmlMetaType::TypeCategory typeCategory(int) const; | - | ||||||||||||
218 | bool isList(int) const; | - | ||||||||||||
219 | int listType(int) const; | - | ||||||||||||
220 | QQmlMetaObject rawMetaObjectForType(int) const; | - | ||||||||||||
221 | QQmlMetaObject metaObjectForType(int) const; | - | ||||||||||||
222 | QQmlPropertyCache *propertyCacheForType(int); | - | ||||||||||||
223 | QQmlPropertyCache *rawPropertyCacheForType(int, int minorVersion = -1); | - | ||||||||||||
224 | void registerInternalCompositeType(QV4::CompiledData::CompilationUnit *compilationUnit); | - | ||||||||||||
225 | void unregisterInternalCompositeType(QV4::CompiledData::CompilationUnit *compilationUnit); | - | ||||||||||||
226 | - | |||||||||||||
227 | bool isTypeLoaded(const QUrl &url) const; | - | ||||||||||||
228 | bool isScriptLoaded(const QUrl &url) const; | - | ||||||||||||
229 | - | |||||||||||||
230 | void sendQuit(); | - | ||||||||||||
231 | void sendExit(int retCode = 0); | - | ||||||||||||
232 | void warning(const QQmlError &); | - | ||||||||||||
233 | void warning(const QList<QQmlError> &); | - | ||||||||||||
234 | static void warning(QQmlEngine *, const QQmlError &); | - | ||||||||||||
235 | static void warning(QQmlEngine *, const QList<QQmlError> &); | - | ||||||||||||
236 | static void warning(QQmlEnginePrivate *, const QQmlError &); | - | ||||||||||||
237 | static void warning(QQmlEnginePrivate *, const QList<QQmlError> &); | - | ||||||||||||
238 | - | |||||||||||||
239 | inline static QV8Engine *getV8Engine(QQmlEngine *e); | - | ||||||||||||
240 | inline static QV4::ExecutionEngine *getV4Engine(QQmlEngine *e); | - | ||||||||||||
241 | inline static QQmlEnginePrivate *get(QQmlEngine *e); | - | ||||||||||||
242 | inline static const QQmlEnginePrivate *get(const QQmlEngine *e); | - | ||||||||||||
243 | inline static QQmlEnginePrivate *get(QQmlContext *c); | - | ||||||||||||
244 | inline static QQmlEnginePrivate *get(QQmlContextData *c); | - | ||||||||||||
245 | inline static QQmlEngine *get(QQmlEnginePrivate *p); | - | ||||||||||||
246 | inline static QQmlEnginePrivate *get(QV4::ExecutionEngine *e); | - | ||||||||||||
247 | - | |||||||||||||
248 | static void registerBaseTypes(const char *uri, int versionMajor, int versionMinor); | - | ||||||||||||
249 | static void registerQtQuick2Types(const char *uri, int versionMajor, int versionMinor); | - | ||||||||||||
250 | static void defineQtQuick2Module(); | - | ||||||||||||
251 | - | |||||||||||||
252 | static bool designerMode(); | - | ||||||||||||
253 | static void activateDesignerMode(); | - | ||||||||||||
254 | - | |||||||||||||
255 | static bool qml_debugging_enabled; | - | ||||||||||||
256 | - | |||||||||||||
257 | mutable QMutex networkAccessManagerMutex; | - | ||||||||||||
258 | - | |||||||||||||
259 | private: | - | ||||||||||||
260 | // These members must be protected by a QQmlEnginePrivate::Locker as they are required by | - | ||||||||||||
261 | // the threaded loader. Only access them through their respective accessor methods. | - | ||||||||||||
262 | QHash<int, QV4::CompiledData::CompilationUnit *> m_compositeTypes; | - | ||||||||||||
263 | static bool s_designerMode; | - | ||||||||||||
264 | - | |||||||||||||
265 | // These members is protected by the full QQmlEnginePrivate::mutex mutex | - | ||||||||||||
266 | struct Deletable { Deletable():next(nullptr) {} virtual ~Deletable() {} Deletable *next; }; never executed: end of block | 0 | ||||||||||||
267 | QFieldList<Deletable, &Deletable::next> toDeleteInEngineThread; | - | ||||||||||||
268 | void doDeleteInEngineThread(); | - | ||||||||||||
269 | - | |||||||||||||
270 | void cleanupScarceResources(); | - | ||||||||||||
271 | }; | - | ||||||||||||
272 | - | |||||||||||||
273 | /* | - | ||||||||||||
274 | This function should be called prior to evaluation of any js expression, | - | ||||||||||||
275 | so that scarce resources are not freed prematurely (eg, if there is a | - | ||||||||||||
276 | nested javascript expression). | - | ||||||||||||
277 | */ | - | ||||||||||||
278 | inline void QQmlEnginePrivate::referenceScarceResources() | - | ||||||||||||
279 | { | - | ||||||||||||
280 | scarceResourcesRefCount += 1; | - | ||||||||||||
281 | } executed 2179104 times by 140 tests: end of block Executed by:
| 2179104 | ||||||||||||
282 | - | |||||||||||||
283 | /* | - | ||||||||||||
284 | This function should be called after evaluation of the js expression is | - | ||||||||||||
285 | complete, and so the scarce resources may be freed safely. | - | ||||||||||||
286 | */ | - | ||||||||||||
287 | inline void QQmlEnginePrivate::dereferenceScarceResources() | - | ||||||||||||
288 | { | - | ||||||||||||
289 | Q_ASSERT(scarceResourcesRefCount > 0); | - | ||||||||||||
290 | scarceResourcesRefCount -= 1; | - | ||||||||||||
291 | - | |||||||||||||
292 | // if the refcount is zero, then evaluation of the "top level" | - | ||||||||||||
293 | // expression must have completed. We can safely release the | - | ||||||||||||
294 | // scarce resources. | - | ||||||||||||
295 | if (Q_LIKELY(scarceResourcesRefCount == 0)) {
| 56007-2123097 | ||||||||||||
296 | QV4::ExecutionEngine *engine = v4engine(); | - | ||||||||||||
297 | if (Q_UNLIKELY(!engine->scarceResources.isEmpty())) {
| 36-2123061 | ||||||||||||
298 | cleanupScarceResources(); | - | ||||||||||||
299 | } executed 36 times by 1 test: end of block Executed by:
| 36 | ||||||||||||
300 | } executed 2123097 times by 140 tests: end of block Executed by:
| 2123097 | ||||||||||||
301 | } executed 2179104 times by 140 tests: end of block Executed by:
| 2179104 | ||||||||||||
302 | - | |||||||||||||
303 | /*! | - | ||||||||||||
304 | Returns true if the calling thread is the QQmlEngine thread. | - | ||||||||||||
305 | */ | - | ||||||||||||
306 | bool QQmlEnginePrivate::isEngineThread() const | - | ||||||||||||
307 | { | - | ||||||||||||
308 | Q_Q(const QQmlEngine); | - | ||||||||||||
309 | return QThread::currentThread() == q->thread(); executed 6090 times by 63 tests: return QThread::currentThread() == q->thread(); Executed by:
| 6090 | ||||||||||||
310 | } | - | ||||||||||||
311 | - | |||||||||||||
312 | /*! | - | ||||||||||||
313 | Returns true if the calling thread is the QQmlEngine \a engine thread. | - | ||||||||||||
314 | */ | - | ||||||||||||
315 | bool QQmlEnginePrivate::isEngineThread(const QQmlEngine *engine) | - | ||||||||||||
316 | { | - | ||||||||||||
317 | Q_ASSERT(engine); | - | ||||||||||||
318 | return QQmlEnginePrivate::get(engine)->isEngineThread(); executed 741 times by 17 tests: return QQmlEnginePrivate::get(engine)->isEngineThread(); Executed by:
| 741 | ||||||||||||
319 | } | - | ||||||||||||
320 | - | |||||||||||||
321 | /*! | - | ||||||||||||
322 | Delete \a value in the engine thread. If the calling thread is the engine | - | ||||||||||||
323 | thread, \a value will be deleted immediately. | - | ||||||||||||
324 | - | |||||||||||||
325 | This method should be used for *any* type that has resources that need to | - | ||||||||||||
326 | be freed in the engine thread. This is generally types that use V8 handles. | - | ||||||||||||
327 | As there is some small overhead in checking the current thread, it is best | - | ||||||||||||
328 | practice to check if any V8 handles actually need to be freed and delete | - | ||||||||||||
329 | the instance directly if not. | - | ||||||||||||
330 | */ | - | ||||||||||||
331 | template<typename T> | - | ||||||||||||
332 | void QQmlEnginePrivate::deleteInEngineThread(T *value) | - | ||||||||||||
333 | { | - | ||||||||||||
334 | Q_Q(QQmlEngine); | - | ||||||||||||
335 | - | |||||||||||||
336 | Q_ASSERT(value); | - | ||||||||||||
337 | if (isEngineThread()) {
| 0-5349 | ||||||||||||
338 | delete value; | - | ||||||||||||
339 | } else { executed 5349 times by 54 tests: end of block Executed by:
| 5349 | ||||||||||||
340 | struct I : public Deletable { | - | ||||||||||||
341 | I(T *value) : value(value) {} never executed: end of block | 0 | ||||||||||||
342 | ~I() override { delete value; } never executed: end of block | 0 | ||||||||||||
343 | T *value; | - | ||||||||||||
344 | }; | - | ||||||||||||
345 | I *i = new I(value); | - | ||||||||||||
346 | mutex.lock(); | - | ||||||||||||
347 | bool wasEmpty = toDeleteInEngineThread.isEmpty(); | - | ||||||||||||
348 | toDeleteInEngineThread.append(i); | - | ||||||||||||
349 | mutex.unlock(); | - | ||||||||||||
350 | if (wasEmpty)
| 0 | ||||||||||||
351 | QCoreApplication::postEvent(q, new QEvent(QEvent::User)); never executed: QCoreApplication::postEvent(q, new QEvent(QEvent::User)); | 0 | ||||||||||||
352 | } never executed: end of block | 0 | ||||||||||||
353 | } | - | ||||||||||||
354 | - | |||||||||||||
355 | /*! | - | ||||||||||||
356 | Delete \a value in the \a engine thread. If the calling thread is the engine | - | ||||||||||||
357 | thread, \a value will be deleted immediately. | - | ||||||||||||
358 | */ | - | ||||||||||||
359 | template<typename T> | - | ||||||||||||
360 | void QQmlEnginePrivate::deleteInEngineThread(QQmlEnginePrivate *engine, T *value) | - | ||||||||||||
361 | { | - | ||||||||||||
362 | Q_ASSERT(engine); | - | ||||||||||||
363 | engine->deleteInEngineThread<T>(value); | - | ||||||||||||
364 | } executed 5349 times by 54 tests: end of block Executed by:
| 5349 | ||||||||||||
365 | - | |||||||||||||
366 | /*! | - | ||||||||||||
367 | Returns a QQmlPropertyCache for \a type with \a minorVersion. | - | ||||||||||||
368 | - | |||||||||||||
369 | The returned cache is not referenced, so if it is to be stored, call addref(). | - | ||||||||||||
370 | */ | - | ||||||||||||
371 | QQmlPropertyCache *QQmlEnginePrivate::cache(const QQmlType &type, int minorVersion) | - | ||||||||||||
372 | { | - | ||||||||||||
373 | Q_ASSERT(type.isValid()); | - | ||||||||||||
374 | - | |||||||||||||
375 | if (minorVersion == -1 || !type.containsRevisionedAttributes())
| 0-63065 | ||||||||||||
376 | return cache(type.metaObject()); never executed: return cache(type.metaObject()); | 0 | ||||||||||||
377 | - | |||||||||||||
378 | Locker locker(this); | - | ||||||||||||
379 | return QQmlMetaType::propertyCache(type, minorVersion); executed 63065 times by 134 tests: return QQmlMetaType::propertyCache(type, minorVersion); Executed by:
| 63065 | ||||||||||||
380 | } | - | ||||||||||||
381 | - | |||||||||||||
382 | QV8Engine *QQmlEnginePrivate::getV8Engine(QQmlEngine *e) | - | ||||||||||||
383 | { | - | ||||||||||||
384 | Q_ASSERT(e); | - | ||||||||||||
385 | - | |||||||||||||
386 | return e->handle()->v8Engine; never executed: return e->handle()->v8Engine; | 0 | ||||||||||||
387 | } | - | ||||||||||||
388 | - | |||||||||||||
389 | QV4::ExecutionEngine *QQmlEnginePrivate::getV4Engine(QQmlEngine *e) | - | ||||||||||||
390 | { | - | ||||||||||||
391 | Q_ASSERT(e); | - | ||||||||||||
392 | - | |||||||||||||
393 | return e->handle(); never executed: return e->handle(); | 0 | ||||||||||||
394 | } | - | ||||||||||||
395 | - | |||||||||||||
396 | QQmlEnginePrivate *QQmlEnginePrivate::get(QQmlEngine *e) | - | ||||||||||||
397 | { | - | ||||||||||||
398 | Q_ASSERT(e); | - | ||||||||||||
399 | - | |||||||||||||
400 | return e->d_func(); executed 15920789 times by 145 tests: return e->d_func(); Executed by:
| 15920789 | ||||||||||||
401 | } | - | ||||||||||||
402 | - | |||||||||||||
403 | const QQmlEnginePrivate *QQmlEnginePrivate::get(const QQmlEngine *e) | - | ||||||||||||
404 | { | - | ||||||||||||
405 | Q_ASSERT(e); | - | ||||||||||||
406 | - | |||||||||||||
407 | return e ? e->d_func() : nullptr; executed 741 times by 17 tests: return e ? e->d_func() : nullptr; Executed by:
| 741 | ||||||||||||
408 | } | - | ||||||||||||
409 | - | |||||||||||||
410 | QQmlEnginePrivate *QQmlEnginePrivate::get(QQmlContext *c) | - | ||||||||||||
411 | { | - | ||||||||||||
412 | return (c && c->engine()) ? QQmlEnginePrivate::get(c->engine()) : nullptr; executed 76 times by 4 tests: return (c && c->engine()) ? QQmlEnginePrivate::get(c->engine()) : nullptr; Executed by:
| 76 | ||||||||||||
413 | } | - | ||||||||||||
414 | - | |||||||||||||
415 | QQmlEnginePrivate *QQmlEnginePrivate::get(QQmlContextData *c) | - | ||||||||||||
416 | { | - | ||||||||||||
417 | return (c && c->engine) ? QQmlEnginePrivate::get(c->engine) : nullptr; executed 998205 times by 126 tests: return (c && c->engine) ? QQmlEnginePrivate::get(c->engine) : nullptr; Executed by:
| 998205 | ||||||||||||
418 | } | - | ||||||||||||
419 | - | |||||||||||||
420 | QQmlEngine *QQmlEnginePrivate::get(QQmlEnginePrivate *p) | - | ||||||||||||
421 | { | - | ||||||||||||
422 | Q_ASSERT(p); | - | ||||||||||||
423 | - | |||||||||||||
424 | return p->q_func(); executed 116985 times by 142 tests: return p->q_func(); Executed by:
| 116985 | ||||||||||||
425 | } | - | ||||||||||||
426 | - | |||||||||||||
427 | QQmlEnginePrivate *QQmlEnginePrivate::get(QV4::ExecutionEngine *e) | - | ||||||||||||
428 | { | - | ||||||||||||
429 | QQmlEngine *qmlEngine = e->qmlEngine(); | - | ||||||||||||
430 | if (!qmlEngine)
| 0-890762 | ||||||||||||
431 | return nullptr; never executed: return nullptr; | 0 | ||||||||||||
432 | return get(qmlEngine); executed 890762 times by 121 tests: return get(qmlEngine); Executed by:
| 890762 | ||||||||||||
433 | } | - | ||||||||||||
434 | - | |||||||||||||
435 | QT_END_NAMESPACE | - | ||||||||||||
436 | - | |||||||||||||
437 | #endif // QQMLENGINE_P_H | - | ||||||||||||
Source code | Switch to Preprocessed file |