qnetworkaccesscache.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qnetworkaccesscache.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6enum ExpiryTimeEnum {-
7 ExpiryTime = 120-
8};-
9-
10namespace {-
11 struct Receiver-
12 {-
13 QPointer<QObject> object;-
14 const char *member;-
15 };-
16}-
17-
18-
19struct QNetworkAccessCache::Node-
20{-
21 QDateTime timestamp;-
22 QQueue<Receiver> receiverQueue;-
23 QByteArray key;-
24-
25 Node *older, *newer;-
26 CacheableObject *object;-
27-
28 int useCount;-
29-
30 Node()-
31 : older(0), newer(0), object(0), useCount(0)-
32 { }
executed 905 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
905
33};-
34-
35QNetworkAccessCache::CacheableObject::CacheableObject()-
36{-
37-
38-
39}-
40-
41QNetworkAccessCache::CacheableObject::~CacheableObject()-
42{-
43-
44-
45-
46-
47-
48}-
49-
50void QNetworkAccessCache::CacheableObject::setExpires(bool enable)-
51{-
52 expires = enable;-
53}
executed 914 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
914
54-
55void QNetworkAccessCache::CacheableObject::setShareable(bool enable)-
56{-
57 shareable = enable;-
58}
executed 914 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
914
59-
60QNetworkAccessCache::QNetworkAccessCache()-
61 : oldest(0), newest(0)-
62{-
63}
executed 722 times by 11 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
722
64-
65QNetworkAccessCache::~QNetworkAccessCache()-
66{-
67 clear();-
68}
executed 723 times by 12 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_spdy - unknown status
723
69-
70void QNetworkAccessCache::clear()-
71{-
72 NodeHash hashCopy = hash;-
73 hash.clear();-
74-
75-
76 NodeHash::Iterator it = hashCopy.begin();-
77 NodeHash::Iterator end = hashCopy.end();-
78 for ( ; it != end
it != endDescription
TRUEevaluated 895 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_spdy - unknown status
FALSEevaluated 2015 times by 12 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_spdy - unknown status
; ++it) {
895-2015
79 it->object->key.clear();-
80 it->object->dispose();-
81 }
executed 895 times by 9 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_spdy - unknown status
895
82-
83-
84 hashCopy.clear();-
85-
86 timer.stop();-
87-
88 oldest = newest = 0;-
89}
executed 2015 times by 12 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_spdy - unknown status
2015
90-
91-
92-
93-
94-
95void QNetworkAccessCache::linkEntry(const QByteArray &key)-
96{-
97 NodeHash::Iterator it = hash.find(key);-
98 if (it == hash.end()
it == hash.end()Description
TRUEnever evaluated
FALSEevaluated 628 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
)
0-628
99 return;
never executed: return;
0
100-
101 Node *const node = &it.value();-
102 ((!(node != oldest && node != newest)) ? qt_assert("node != oldest && node != newest",__FILE__,146) : qt_noop());-
103 ((!(node->older == 0 && node->newer == 0)) ? qt_assert("node->older == 0 && node->newer == 0",__FILE__,147) : qt_noop());-
104 ((!(node->useCount == 0)) ? qt_assert("node->useCount == 0",__FILE__,148) : qt_noop());-
105-
106 if (newest
newestDescription
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 606 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
) {
22-606
107 ((!(newest->newer == 0)) ? qt_assert("newest->newer == 0",__FILE__,151) : qt_noop());-
108 newest->newer = node;-
109 node->older = newest;-
110 }
executed 22 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
22
111 if (!oldest
!oldestDescription
TRUEevaluated 606 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
) {
22-606
112-
113 oldest = node;-
114 }
executed 606 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
606
115-
116 node->timestamp = QDateTime::currentDateTimeUtc().addSecs(ExpiryTime);-
117 newest = node;-
118}
executed 628 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
628
119-
120-
121-
122-
123-
124bool QNetworkAccessCache::unlinkEntry(const QByteArray &key)-
125{-
126 NodeHash::Iterator it = hash.find(key);-
127 if (it == hash.end()
it == hash.end()Description
TRUEevaluated 905 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 59 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
)
59-905
128 return
executed 905 times by 8 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
false;
executed 905 times by 8 tests: return false;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
905
129-
130 Node *const node = &it.value();-
131-
132 bool wasOldest = false;-
133 if (node == oldest
node == oldestDescription
TRUEevaluated 29 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
) {
29-30
134 oldest = node->newer;-
135 wasOldest = true;-
136 }
executed 29 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
29
137 if (node == newest
node == newestDescription
TRUEevaluated 34 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
)
25-34
138 newest = node->older;
executed 34 times by 3 tests: newest = node->older;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
34
139 if (node->older
node->olderDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 47 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
)
12-47
140 node->older->newer = node->newer;
executed 12 times by 1 test: node->older->newer = node->newer;
Executed by:
  • tst_Spdy
12
141 if (node->newer
node->newerDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_Spdy
FALSEevaluated 52 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
)
7-52
142 node->newer->older = node->older;
executed 7 times by 1 test: node->newer->older = node->older;
Executed by:
  • tst_Spdy
7
143-
144 node->newer = node->older = 0;-
145 return
executed 59 times by 3 tests: return wasOldest;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
wasOldest;
executed 59 times by 3 tests: return wasOldest;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
59
146}-
147-
148void QNetworkAccessCache::updateTimer()-
149{-
150 timer.stop();-
151-
152 if (!oldest
!oldestDescription
TRUEevaluated 28 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 607 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
)
28-607
153 return;
executed 28 times by 2 tests: return;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
28
154-
155 int interval = QDateTime::currentDateTimeUtc().secsTo(oldest->timestamp);-
156 if (interval <= 0
interval <= 0Description
TRUEnever evaluated
FALSEevaluated 607 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
) {
0-607
157 interval = 0;-
158 }
never executed: end of block
else {
0
159-
160 interval = (interval + 15) & ~16;-
161 }
executed 607 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
607
162-
163 timer.start(interval * 1000, this);-
164}
executed 607 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
607
165-
166bool QNetworkAccessCache::emitEntryReady(Node *node, QObject *target, const char *member)-
167{-
168 if (!connect(this, qFlagLocation("2""entryReady(QNetworkAccessCache::CacheableObject*)" "\0" __FILE__ ":" "212"),
!connect(this,...uedConnection)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
0-1
169 target, member, Qt::QueuedConnection)
!connect(this,...uedConnection)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-1
170 return
never executed: return false;
false;
never executed: return false;
0
171-
172 entryReady(node->object);-
173 disconnect(qFlagLocation("2""entryReady(QNetworkAccessCache::CacheableObject*)" "\0" __FILE__ ":" "217"));-
174-
175 return
executed 1 time by 1 test: return true;
Executed by:
  • tst_QNetworkReply
true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QNetworkReply
1
176}-
177-
178void QNetworkAccessCache::timerEvent(QTimerEvent *)-
179{-
180-
181 const QDateTime now = QDateTime::currentDateTimeUtc();-
182-
183 while (oldest
oldestDescription
TRUEnever evaluated
FALSEnever evaluated
&& oldest->timestamp < now
oldest->timestamp < nowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
184 Node *next = oldest->newer;-
185 oldest->object->dispose();-
186-
187 hash.remove(oldest->key);-
188 oldest = next;-
189 }
never executed: end of block
0
190-
191-
192 if (oldest
oldestDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
193 oldest->older = 0;
never executed: oldest->older = 0;
0
194 else-
195 newest = 0;
never executed: newest = 0;
0
196-
197 updateTimer();-
198}
never executed: end of block
0
199-
200void QNetworkAccessCache::addEntry(const QByteArray &key, CacheableObject *entry)-
201{-
202 ((!(!key.isEmpty())) ? qt_assert("!key.isEmpty()",__FILE__,246) : qt_noop());-
203-
204 if (unlinkEntry(key)
unlinkEntry(key)Description
TRUEnever evaluated
FALSEevaluated 914 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
)
0-914
205 updateTimer();
never executed: updateTimer();
0
206-
207 Node &node = hash[key];-
208 if (node.useCount
node.useCountDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 905 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
)
9-905
209 QMessageLogger(__FILE__, 253, __PRETTY_FUNCTION__).warning("QNetworkAccessCache::addEntry: overriding active cache entry '%s'",
executed 9 times by 1 test: QMessageLogger(__FILE__, 253, __PRETTY_FUNCTION__).warning("QNetworkAccessCache::addEntry: overriding active cache entry '%s'", key.constData());
Executed by:
  • tst_QNetworkReply
9
210 key.constData());
executed 9 times by 1 test: QMessageLogger(__FILE__, 253, __PRETTY_FUNCTION__).warning("QNetworkAccessCache::addEntry: overriding active cache entry '%s'", key.constData());
Executed by:
  • tst_QNetworkReply
9
211 if (node.object
node.objectDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 905 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
)
9-905
212 node.object->dispose();
executed 9 times by 1 test: node.object->dispose();
Executed by:
  • tst_QNetworkReply
9
213 node.object = entry;-
214 node.object->key = key;-
215 node.key = key;-
216 node.useCount = 1;-
217}
executed 914 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
914
218-
219bool QNetworkAccessCache::hasEntry(const QByteArray &key) const-
220{-
221 return
executed 997 times by 4 tests: return hash.contains(key);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
hash.contains(key);
executed 997 times by 4 tests: return hash.contains(key);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
997
222}-
223-
224bool QNetworkAccessCache::requestEntry(const QByteArray &key, QObject *target, const char *member)-
225{-
226 NodeHash::Iterator it = hash.find(key);-
227 if (it == hash.end()
it == hash.end()Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
)
1-48
228 return
executed 48 times by 1 test: return false;
Executed by:
  • tst_QNetworkReply
false;
executed 48 times by 1 test: return false;
Executed by:
  • tst_QNetworkReply
48
229-
230 Node *node = &it.value();-
231-
232 if (node->useCount > 0
node->useCount > 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
&& !node->object->shareable
!node->object->shareableDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-1
233-
234-
235 ((!(node->older == 0 && node->newer == 0)) ? qt_assert("node->older == 0 && node->newer == 0",__FILE__,279) : qt_noop());-
236 Receiver receiver;-
237 receiver.object = target;-
238 receiver.member = member;-
239 node->receiverQueue.enqueue(receiver);-
240-
241-
242 return
executed 1 time by 1 test: return true;
Executed by:
  • tst_QNetworkReply
true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QNetworkReply
1
243 } else {-
244-
245 if (unlinkEntry(key)
unlinkEntry(key)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
246 updateTimer();
never executed: updateTimer();
0
247-
248 ++node->useCount;-
249 return
never executed: return emitEntryReady(node, target, member);
emitEntryReady(node, target, member);
never executed: return emitEntryReady(node, target, member);
0
250 }-
251}-
252-
253QNetworkAccessCache::CacheableObject *QNetworkAccessCache::requestEntryNow(const QByteArray &key)-
254{-
255 NodeHash::Iterator it = hash.find(key);-
256 if (it == hash.end()
it == hash.end()Description
TRUEevaluated 551 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 718 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
)
551-718
257 return
executed 551 times by 8 tests: return 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
0;
executed 551 times by 8 tests: return 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
551
258 if (it->useCount > 0
it->useCount > 0Description
TRUEevaluated 677 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 41 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
) {
41-677
259 if (it->object->shareable
it->object->shareableDescription
TRUEevaluated 677 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
FALSEnever evaluated
) {
0-677
260 ++it->useCount;-
261 return
executed 677 times by 3 tests: return it->object;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
it->object;
executed 677 times by 3 tests: return it->object;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
677
262 }-
263-
264-
265 return
never executed: return 0;
0;
never executed: return 0;
0
266 }-
267-
268-
269 bool wasOldest = unlinkEntry(key);-
270 ++it->useCount;-
271-
272 if (wasOldest
wasOldestDescription
TRUEevaluated 29 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_Spdy
)
12-29
273 updateTimer();
executed 29 times by 3 tests: updateTimer();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
29
274 return
executed 41 times by 3 tests: return it->object;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
it->object;
executed 41 times by 3 tests: return it->object;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_Spdy
41
275}-
276-
277void QNetworkAccessCache::releaseEntry(const QByteArray &key)-
278{-
279 NodeHash::Iterator it = hash.find(key);-
280 if (it == hash.end()
it == hash.end()Description
TRUEnever evaluated
FALSEevaluated 1304 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
) {
0-1304
281 QMessageLogger(__FILE__, 325, __PRETTY_FUNCTION__).warning("QNetworkAccessCache::releaseEntry: trying to release key '%s' that is not in cache",-
282 key.constData());-
283 return;
never executed: return;
0
284 }-
285-
286 Node *node = &it.value();-
287 ((!(node->useCount > 0)) ? qt_assert("node->useCount > 0",__FILE__,331) : qt_noop());-
288-
289-
290 if (!node->receiverQueue.isEmpty()
!node->receiverQueue.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEevaluated 1303 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
) {
1-1303
291-
292 Receiver receiver;-
293 do {-
294 receiver = node->receiverQueue.dequeue();-
295 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkReply
while (receiver.object.isNull()
receiver.object.isNull()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
&& !node->receiverQueue.isEmpty()
!node->receiverQueue.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
);
0-1
296-
297 if (!receiver.object.isNull()
!receiver.object.isNull()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
) {
0-1
298 emitEntryReady(node, receiver.object, receiver.member);-
299 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QNetworkReply
1
300 }-
301 }
never executed: end of block
0
302-
303 if (!--node->useCount
!--node->useCountDescription
TRUEevaluated 628 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 675 times by 3 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
) {
628-675
304-
305 if (node->object->expires
node->object->expiresDescription
TRUEevaluated 628 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEnever evaluated
)
0-628
306 linkEntry(key);
executed 628 times by 8 tests: linkEntry(key);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
628
307-
308 if (oldest == node
oldest == nodeDescription
TRUEevaluated 606 times by 8 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
)
22-606
309 updateTimer();
executed 606 times by 8 tests: updateTimer();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
606
310 }
executed 628 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
628
311}
executed 1303 times by 8 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
1303
312-
313void QNetworkAccessCache::removeEntry(const QByteArray &key)-
314{-
315 NodeHash::Iterator it = hash.find(key);-
316 if (it == hash.end()
it == hash.end()Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QNetworkReply
) {
0-9
317 QMessageLogger(__FILE__, 361, __PRETTY_FUNCTION__).warning("QNetworkAccessCache::removeEntry: trying to remove key '%s' that is not in cache",-
318 key.constData());-
319 return;
never executed: return;
0
320 }-
321-
322 Node *node = &it.value();-
323 if (unlinkEntry(key)
unlinkEntry(key)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-9
324 updateTimer();
never executed: updateTimer();
0
325 if (node->useCount > 1
node->useCount > 1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QNetworkReply
)
0-9
326 QMessageLogger(__FILE__, 370, __PRETTY_FUNCTION__).warning("QNetworkAccessCache::removeEntry: removing active cache entry '%s'",
never executed: QMessageLogger(__FILE__, 370, __PRETTY_FUNCTION__).warning("QNetworkAccessCache::removeEntry: removing active cache entry '%s'", key.constData());
0
327 key.constData());
never executed: QMessageLogger(__FILE__, 370, __PRETTY_FUNCTION__).warning("QNetworkAccessCache::removeEntry: removing active cache entry '%s'", key.constData());
0
328-
329 node->object->key.clear();-
330 hash.remove(node->key);-
331}
executed 9 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
9
332-
333-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9