access/qnetworkaccessbackend.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9class QNetworkAccessBackendFactoryData: public QList<QNetworkAccessBackendFactory *> -
10{ -
11public: -
12 QNetworkAccessBackendFactoryData() : mutex(QMutex::Recursive) -
13 { -
14 valid.ref(); -
15 }
executed: }
Execution Count:8
8
16 ~QNetworkAccessBackendFactoryData() -
17 { -
18 QMutexLocker locker(&mutex); -
19 valid.deref(); -
20 }
executed: }
Execution Count:8
8
21 -
22 QMutex mutex; -
23 -
24 static QBasicAtomicInt valid; -
25}; -
26static QNetworkAccessBackendFactoryData *factoryData() { static QGlobalStatic<QNetworkAccessBackendFactoryData > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QNetworkAccessBackendFactoryData *x = new QNetworkAccessBackendFactoryData; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QNetworkAccessBackendFactoryData > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:331
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:323
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-331
27QBasicAtomicInt QNetworkAccessBackendFactoryData::valid = { (0) }; -
28 -
29QNetworkAccessBackendFactory::QNetworkAccessBackendFactory() -
30{ -
31 QMutexLocker locker(&factoryData()->mutex); -
32 factoryData()->append(this); -
33}
executed: }
Execution Count:16
16
34 -
35QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory() -
36{ -
37 if (QNetworkAccessBackendFactoryData::valid.load()) {
partially evaluated: QNetworkAccessBackendFactoryData::valid.load()
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
38 QMutexLocker locker(&factoryData()->mutex); -
39 factoryData()->removeAll(this); -
40 }
executed: }
Execution Count:16
16
41}
executed: }
Execution Count:16
16
42 -
43QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessManager::Operation op, -
44 const QNetworkRequest &request) -
45{ -
46 if (QNetworkAccessBackendFactoryData::valid.load()) {
partially evaluated: QNetworkAccessBackendFactoryData::valid.load()
TRUEFALSE
yes
Evaluation Count:89
no
Evaluation Count:0
0-89
47 QMutexLocker locker(&factoryData()->mutex); -
48 QNetworkAccessBackendFactoryData::ConstIterator it = factoryData()->constBegin(), -
49 end = factoryData()->constEnd(); -
50 while (it != end) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:136
yes
Evaluation Count:4
4-136
51 QNetworkAccessBackend *backend = (*it)->create(op, request); -
52 if (backend) {
evaluated: backend
TRUEFALSE
yes
Evaluation Count:85
yes
Evaluation Count:51
51-85
53 backend->manager = this; -
54 return backend;
executed: return backend;
Execution Count:85
85
55 } -
56 ++it; -
57 }
executed: }
Execution Count:51
51
58 }
executed: }
Execution Count:4
4
59 return 0;
executed: return 0;
Execution Count:4
4
60} -
61 -
62QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice() -
63{ -
64 if (reply->outgoingDataBuffer)
partially evaluated: reply->outgoingDataBuffer
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:50
0-50
65 uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(reply->outgoingDataBuffer));
never executed: uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(reply->outgoingDataBuffer));
0
66 else if (reply->outgoingData) {
partially evaluated: reply->outgoingData
TRUEFALSE
yes
Evaluation Count:50
no
Evaluation Count:0
0-50
67 uploadByteDevice = QSharedPointer<QNonContiguousByteDevice>(QNonContiguousByteDeviceFactory::create(reply->outgoingData)); -
68 } else {
executed: }
Execution Count:50
50
69 return 0;
never executed: return 0;
0
70 } -
71 -
72 bool bufferDisallowed = -
73 reply->request.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, -
74 QVariant(false)) == QVariant(true); -
75 if (bufferDisallowed)
partially evaluated: bufferDisallowed
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:50
0-50
76 uploadByteDevice->disableReset();
never executed: uploadByteDevice->disableReset();
0
77 -
78 -
79 if (!isSynchronous())
partially evaluated: !isSynchronous()
TRUEFALSE
yes
Evaluation Count:50
no
Evaluation Count:0
0-50
80 connect(uploadByteDevice.data(), "2""readProgress(qint64,qint64)", this, "1""emitReplyUploadProgress(qint64,qint64)");
executed: connect(uploadByteDevice.data(), "2""readProgress(qint64,qint64)", this, "1""emitReplyUploadProgress(qint64,qint64)");
Execution Count:50
50
81 -
82 return uploadByteDevice.data();
executed: return uploadByteDevice.data();
Execution Count:50
50
83} -
84 -
85 -
86 -
87void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal) -
88{ -
89 if (reply->isFinished)
partially evaluated: reply->isFinished
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:896
0-896
90 return;
never executed: return;
0
91 reply->emitUploadProgress(bytesSent, bytesTotal); -
92}
executed: }
Execution Count:896
896
93 -
94QNetworkAccessBackend::QNetworkAccessBackend() -
95 : manager(0) -
96 , reply(0) -
97 , synchronous(false) -
98{ -
99}
executed: }
Execution Count:98
98
100 -
101QNetworkAccessBackend::~QNetworkAccessBackend() -
102{ -
103} -
104 -
105void QNetworkAccessBackend::downstreamReadyWrite() -
106{ -
107 -
108} -
109 -
110void QNetworkAccessBackend::setDownstreamLimited(bool b) -
111{ -
112 (void)b;; -
113 -
114}
never executed: }
0
115 -
116void QNetworkAccessBackend::copyFinished(QIODevice *) -
117{ -
118 -
119} -
120 -
121void QNetworkAccessBackend::ignoreSslErrors() -
122{ -
123 -
124} -
125 -
126void QNetworkAccessBackend::ignoreSslErrors(const QList<QSslError> &errors) -
127{ -
128 (void)errors;; -
129 -
130}
never executed: }
0
131 -
132void QNetworkAccessBackend::fetchSslConfiguration(QSslConfiguration &) const -
133{ -
134 -
135} -
136 -
137void QNetworkAccessBackend::setSslConfiguration(const QSslConfiguration &) -
138{ -
139 -
140} -
141 -
142QNetworkCacheMetaData QNetworkAccessBackend::fetchCacheMetaData(const QNetworkCacheMetaData &) const -
143{ -
144 return QNetworkCacheMetaData();
never executed: return QNetworkCacheMetaData();
0
145} -
146 -
147QNetworkAccessManager::Operation QNetworkAccessBackend::operation() const -
148{ -
149 return reply->operation;
executed: return reply->operation;
Execution Count:256
256
150} -
151 -
152QNetworkRequest QNetworkAccessBackend::request() const -
153{ -
154 return reply->request;
executed: return reply->request;
Execution Count:98
98
155} -
156 -
157 -
158QList<QNetworkProxy> QNetworkAccessBackend::proxyList() const -
159{ -
160 return reply->proxyList;
executed: return reply->proxyList;
Execution Count:42
42
161} -
162 -
163 -
164QAbstractNetworkCache *QNetworkAccessBackend::networkCache() const -
165{ -
166 if (!manager)
partially evaluated: !manager
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35
0-35
167 return 0;
never executed: return 0;
0
168 return manager->networkCache;
executed: return manager->networkCache;
Execution Count:35
35
169} -
170 -
171void QNetworkAccessBackend::setCachingEnabled(bool enable) -
172{ -
173 reply->setCachingEnabled(enable); -
174}
executed: }
Execution Count:35
35
175 -
176bool QNetworkAccessBackend::isCachingEnabled() const -
177{ -
178 return reply->isCachingEnabled();
never executed: return reply->isCachingEnabled();
0
179} -
180 -
181qint64 QNetworkAccessBackend::nextDownstreamBlockSize() const -
182{ -
183 return reply->nextDownstreamBlockSize();
executed: return reply->nextDownstreamBlockSize();
Execution Count:38
38
184} -
185 -
186void QNetworkAccessBackend::writeDownstreamData(QByteDataBuffer &list) -
187{ -
188 reply->appendDownstreamData(list); -
189}
executed: }
Execution Count:822
822
190 -
191void QNetworkAccessBackend::writeDownstreamData(QIODevice *data) -
192{ -
193 reply->appendDownstreamData(data); -
194}
executed: }
Execution Count:9
9
195 -
196 -
197void QNetworkAccessBackend::writeDownstreamDataDownloadBuffer(qint64 bytesReceived, qint64 bytesTotal) -
198{ -
199 reply->appendDownstreamDataDownloadBuffer(bytesReceived, bytesTotal); -
200}
never executed: }
0
201 -
202char* QNetworkAccessBackend::getDownloadBuffer(qint64 size) -
203{ -
204 return reply->getDownloadBuffer(size);
never executed: return reply->getDownloadBuffer(size);
0
205} -
206 -
207QVariant QNetworkAccessBackend::header(QNetworkRequest::KnownHeaders header) const -
208{ -
209 return reply->q_func()->header(header);
never executed: return reply->q_func()->header(header);
0
210} -
211 -
212void QNetworkAccessBackend::setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value) -
213{ -
214 reply->setCookedHeader(header, value); -
215}
executed: }
Execution Count:52
52
216 -
217bool QNetworkAccessBackend::hasRawHeader(const QByteArray &headerName) const -
218{ -
219 return reply->q_func()->hasRawHeader(headerName);
never executed: return reply->q_func()->hasRawHeader(headerName);
0
220} -
221 -
222QByteArray QNetworkAccessBackend::rawHeader(const QByteArray &headerName) const -
223{ -
224 return reply->q_func()->rawHeader(headerName);
never executed: return reply->q_func()->rawHeader(headerName);
0
225} -
226 -
227QList<QByteArray> QNetworkAccessBackend::rawHeaderList() const -
228{ -
229 return reply->q_func()->rawHeaderList();
never executed: return reply->q_func()->rawHeaderList();
0
230} -
231 -
232void QNetworkAccessBackend::setRawHeader(const QByteArray &headerName, const QByteArray &headerValue) -
233{ -
234 reply->setRawHeader(headerName, headerValue); -
235}
executed: }
Execution Count:36
36
236 -
237QVariant QNetworkAccessBackend::attribute(QNetworkRequest::Attribute code) const -
238{ -
239 return reply->q_func()->attribute(code);
never executed: return reply->q_func()->attribute(code);
0
240} -
241 -
242void QNetworkAccessBackend::setAttribute(QNetworkRequest::Attribute code, const QVariant &value) -
243{ -
244 if (value.isValid())
evaluated: value.isValid()
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:8
8-25
245 reply->attributes.insert(code, value);
executed: reply->attributes.insert(code, value);
Execution Count:25
25
246 else -
247 reply->attributes.remove(code);
executed: reply->attributes.remove(code);
Execution Count:8
8
248} -
249QUrl QNetworkAccessBackend::url() const -
250{ -
251 return reply->url;
executed: return reply->url;
Execution Count:333
333
252} -
253 -
254void QNetworkAccessBackend::setUrl(const QUrl &url) -
255{ -
256 reply->url = url; -
257}
executed: }
Execution Count:46
46
258 -
259void QNetworkAccessBackend::finished() -
260{ -
261 reply->finished(); -
262}
executed: }
Execution Count:97
97
263 -
264void QNetworkAccessBackend::error(QNetworkReply::NetworkError code, const QString &errorString) -
265{ -
266 reply->error(code, errorString); -
267}
executed: }
Execution Count:14
14
268 -
269 -
270void QNetworkAccessBackend::proxyAuthenticationRequired(const QNetworkProxy &proxy, -
271 QAuthenticator *authenticator) -
272{ -
273 manager->proxyAuthenticationRequired(proxy, synchronous, authenticator, &reply->lastProxyAuthentication); -
274}
never executed: }
0
275 -
276 -
277void QNetworkAccessBackend::authenticationRequired(QAuthenticator *authenticator) -
278{ -
279 manager->authenticationRequired(authenticator, reply->q_func(), synchronous, reply->url, &reply->urlForLastAuthentication); -
280}
executed: }
Execution Count:1
1
281 -
282void QNetworkAccessBackend::metaDataChanged() -
283{ -
284 reply->metaDataChanged(); -
285}
executed: }
Execution Count:46
46
286 -
287void QNetworkAccessBackend::redirectionRequested(const QUrl &target) -
288{ -
289 reply->redirectionRequested(target); -
290}
never executed: }
0
291 -
292void QNetworkAccessBackend::sslErrors(const QList<QSslError> &errors) -
293{ -
294 -
295 reply->sslErrors(errors); -
296 -
297 -
298 -
299}
never executed: }
0
300 -
301 -
302 -
303 -
304 -
305 -
306bool QNetworkAccessBackend::start() -
307{ -
308 -
309 -
310 QSharedPointer<QNetworkSession> networkSession(manager->getNetworkSession()); -
311 if (networkSession) {
partially evaluated: networkSession
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:98
0-98
312 -
313 if (networkSession->isOpen() &&
never evaluated: networkSession->isOpen()
0
314 networkSession->state() == QNetworkSession::Connected) {
never evaluated: networkSession->state() == QNetworkSession::Connected
0
315 -
316 -
317 setProperty("_q_networksession", QVariant::fromValue(networkSession)); -
318 } else {
never executed: }
0
319 -
320 -
321 -
322 const QString host = reply->url.host(); -
323 -
324 if (host == QLatin1String("localhost") ||
never evaluated: host == QLatin1String("localhost")
0
325 QHostAddress(host).isLoopback()) {
never evaluated: QHostAddress(host).isLoopback()
0
326 -
327 } else {
never executed: }
0
328 -
329 return false;
never executed: return false;
0
330 } -
331 } -
332 } -
333 -
334 -
335 -
336 -
337 -
338 -
339 QNetworkSession *session = networkSession.data(); -
340 QNetworkConfiguration config; -
341 if (session) {
partially evaluated: session
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:98
0-98
342 QNetworkConfigurationManager configManager; -
343 -
344 QVariant v = session->sessionProperty(QLatin1String("ActiveConfiguration")); -
345 if (v.isValid())
never evaluated: v.isValid()
0
346 config = configManager.configurationFromIdentifier(qvariant_cast<QString>(v));
never executed: config = configManager.configurationFromIdentifier(qvariant_cast<QString>(v));
0
347 -
348 if (!config.isValid())
never evaluated: !config.isValid()
0
349 config = session->configuration();
never executed: config = session->configuration();
0
350 -
351 if (!config.isValid())
never evaluated: !config.isValid()
0
352 config = QNetworkConfiguration();
never executed: config = QNetworkConfiguration();
0
353 }
never executed: }
0
354 reply->proxyList = manager->queryProxy(QNetworkProxyQuery(config, url())); -
355 -
356 -
357 -
358 -
359 -
360 -
361 -
362 open(); -
363 return true;
executed: return true;
Execution Count:98
98
364} -
365 -
366 -
367 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial