OpenCoverage

qrecyclepool_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/ftw/qrecyclepool_p.h
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5template<typename T, int Step>-
6class QRecyclePoolPrivate-
7{-
8public:-
9 QRecyclePoolPrivate()-
10 : recyclePoolHold(true), outstandingItems(0), cookie(0x33218ADF),-
11 currentPage(nullptr), nextAllocated(nullptr)-
12 {-
13 }
never executed: end of block
0
14-
15 bool recyclePoolHold;-
16 int outstandingItems;-
17 quint32 cookie;-
18-
19 struct PoolType : public T {-
20 union {-
21 QRecyclePoolPrivate<T, Step> *pool;-
22 PoolType *nextAllocated;-
23 };-
24 };-
25-
26 struct Page {-
27 Page *nextPage;-
28 unsigned int free;-
29 union {-
30 char array[Step * sizeof(PoolType)];-
31 qint64 q_for_alignment_1;-
32 double q_for_alignment_2;-
33 };-
34 };-
35-
36 Page *currentPage;-
37 PoolType *nextAllocated;-
38-
39 inline T *allocate();-
40 static inline void dispose(T *);-
41 inline void releaseIfPossible();-
42};-
43-
44template<typename T, int Step = 1024>-
45class QRecyclePool-
46{-
47public:-
48 inline QRecyclePool();-
49 inline ~QRecyclePool();-
50-
51 inline T *New();-
52 template<typename T1>-
53 inline T *New(const T1 &);-
54 template<typename T1>-
55 inline T *New(T1 &);-
56-
57 static inline void Delete(T *);-
58-
59private:-
60 QRecyclePoolPrivate<T, Step> *d;-
61};-
62-
63template<typename T, int Step>-
64QRecyclePool<T, Step>::QRecyclePool()-
65: d(new QRecyclePoolPrivate<T, Step>())-
66{-
67}
never executed: end of block
0
68-
69template<typename T, int Step>-
70QRecyclePool<T, Step>::~QRecyclePool()-
71{-
72 d->recyclePoolHold = false;-
73 d->releaseIfPossible();-
74}
never executed: end of block
0
75-
76template<typename T, int Step>-
77T *QRecyclePool<T, Step>::New()-
78{-
79 T *rv = d->allocate();-
80 new (rv) T;-
81 return
never executed: return rv;
rv;
never executed: return rv;
0
82}-
83-
84template<typename T, int Step>-
85template<typename T1>-
86T *QRecyclePool<T, Step>::New(const T1 &a)-
87{-
88 T *rv = d->allocate();-
89 new (rv) T(a);-
90 return
never executed: return rv;
rv;
never executed: return rv;
0
91}-
92-
93template<typename T, int Step>-
94template<typename T1>-
95T *QRecyclePool<T, Step>::New(T1 &a)-
96{-
97 T *rv = d->allocate();-
98 new (rv) T(a);-
99 return
executed 926499 times by 114 tests: return rv;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • ...
rv;
executed 926499 times by 114 tests: return rv;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • ...
926499
100}-
101-
102template<typename T, int Step>-
103void QRecyclePool<T, Step>::Delete(T *t)-
104{-
105 t->~T();-
106 QRecyclePoolPrivate<T, Step>::dispose(t);-
107}
executed 845675 times by 113 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • ...
845675
108-
109template<typename T, int Step>-
110void QRecyclePoolPrivate<T, Step>::releaseIfPossible()-
111{-
112 if (recyclePoolHold
recyclePoolHoldDescription
TRUEevaluated 821917 times by 112 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlstatemachine
  • ...
FALSEevaluated 23758 times by 9 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
|| outstandingItems
outstandingItemsDescription
TRUEevaluated 23499 times by 9 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
FALSEevaluated 259 times by 8 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
)
259-821917
113 return;
executed 845416 times by 113 tests: return;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • ...
845416
114-
115 Page *p = currentPage;-
116 while (p
pDescription
TRUEevaluated 265 times by 8 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
FALSEevaluated 259 times by 8 tests
Evaluated by:
  • tst_qqmlecmascript
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
) {
259-265
117 Page *n = p->nextPage;-
118 free(p);-
119 p = n;-
120 }
executed 265 times by 8 tests: end of block
Executed by:
  • tst_qqmlecmascript
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
265
121-
122 delete this;-
123}
executed 259 times by 8 tests: end of block
Executed by:
  • tst_qqmlecmascript
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
259
124-
125template<typename T, int Step>-
126T *QRecyclePoolPrivate<T, Step>::allocate()-
127{-
128 PoolType *rv = nullptr;-
129 if (nextAllocated
nextAllocatedDescription
TRUEevaluated 609254 times by 36 tests
Evaluated by:
  • tst_examples
  • tst_flickableinterop
  • tst_qmldiskcache
  • tst_qqmlbinding
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdraghandler
  • tst_qquickdroparea
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquickitem2
  • tst_qquicklayouts
  • ...
FALSEevaluated 317245 times by 114 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • ...
) {
317245-609254
130 rv = nextAllocated;-
131 nextAllocated = rv->nextAllocated;-
132 }
executed 609254 times by 36 tests: end of block
Executed by:
  • tst_examples
  • tst_flickableinterop
  • tst_qmldiskcache
  • tst_qqmlbinding
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlitemmodels
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdesignersupport
  • tst_qquickdrag
  • tst_qquickdraghandler
  • tst_qquickdroparea
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquickitem2
  • tst_qquicklayouts
  • ...
else if (currentPage
currentPageDescription
TRUEevaluated 313735 times by 93 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlstatemachine
  • ...
FALSEevaluated 3510 times by 114 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • ...
&& currentPage->free
currentPage->freeDescription
TRUEevaluated 313633 times by 93 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlstatemachine
  • ...
FALSEevaluated 102 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qqmlnotifier
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_scenegraph
) {
102-609254
133 rv = (PoolType *)(currentPage->array + (Step - currentPage->free) * sizeof(PoolType));-
134 currentPage->free--;-
135 }
executed 313633 times by 93 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlstatemachine
  • ...
else {
313633
136 Page *p = (Page *)malloc(sizeof(Page));-
137 p->nextPage = currentPage;-
138 p->free = Step;-
139 currentPage = p;-
140-
141 rv = (PoolType *)currentPage->array;-
142 currentPage->free--;-
143 }
executed 3612 times by 114 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • ...
3612
144-
145 rv->pool = this;-
146 ++outstandingItems;-
147 return
executed 926499 times by 114 tests: return rv;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • ...
rv;
executed 926499 times by 114 tests: return rv;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • ...
926499
148}-
149-
150template<typename T, int Step>-
151void QRecyclePoolPrivate<T, Step>::dispose(T *t)-
152{-
153 PoolType *pt = static_cast<PoolType *>(t);-
154 ((pt->pool && pt->pool->cookie == 0x33218ADF) ? static_cast<void>(0) : qt_assert("pt->pool && pt->pool->cookie == QRECYCLEPOOLCOOKIE", __FILE__, 207));-
155-
156 QRecyclePoolPrivate<T, Step> *This = pt->pool;-
157 pt->nextAllocated = This->nextAllocated;-
158 This->nextAllocated = pt;-
159 --This->outstandingItems;-
160 This->releaseIfPossible();-
161}
executed 845675 times by 113 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistreference
  • tst_qqmllocale
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • ...
845675
162-
163-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0