21
21
#include " networkreply.h"
22
22
23
23
24
- // #define TEST_PERFORMANCE
25
- #define TEST_PERFORMANCE_EXEC_COUNT 100
24
+ // #define TEST_PERFORMANCE_NO_TASK_LIST
25
+ #define BATCH_REQUEST_EXEC_COUNT 1
26
26
27
27
#define DEFAULT_CONCURRENT_TASK 8
28
28
#define MAX_CONCURRENT_TASK 16
@@ -491,7 +491,7 @@ void NetworkTool::onDownload()
491
491
connect (pReply, SIGNAL (requestFinished (const RequestTask &)),
492
492
this , SLOT (onRequestFinished (const RequestTask &)));
493
493
494
- #ifndef TEST_PERFORMANCE
494
+ #ifndef TEST_PERFORMANCE_NO_TASK_LIST
495
495
m_pListViewDoing->insert (QVariant::fromValue<RequestTask>(req));
496
496
switchTaskView (true );
497
497
#endif
@@ -536,7 +536,7 @@ void NetworkTool::onUpload()
536
536
connect (pReply, SIGNAL (requestFinished (const RequestTask &)),
537
537
this , SLOT (onRequestFinished (const RequestTask &)));
538
538
539
- #ifndef TEST_PERFORMANCE
539
+ #ifndef TEST_PERFORMANCE_NO_TASK_LIST
540
540
m_pListViewDoing->insert (QVariant::fromValue<RequestTask>(req));
541
541
switchTaskView (true );
542
542
#endif
@@ -570,7 +570,7 @@ void NetworkTool::onGetRequest()
570
570
connect (pReply, SIGNAL (requestFinished (const RequestTask &)),
571
571
this , SLOT (onRequestFinished (const RequestTask &)));
572
572
573
- #ifndef TEST_PERFORMANCE
573
+ #ifndef TEST_PERFORMANCE_NO_TASK_LIST
574
574
m_pListViewDoing->insert (QVariant::fromValue<RequestTask>(req));
575
575
switchTaskView (true );
576
576
#endif
@@ -614,7 +614,7 @@ void NetworkTool::onPostRequest()
614
614
connect (pReply, SIGNAL (requestFinished (const RequestTask &)),
615
615
this , SLOT (onRequestFinished (const RequestTask &)));
616
616
617
- #ifndef TEST_PERFORMANCE
617
+ #ifndef TEST_PERFORMANCE_NO_TASK_LIST
618
618
m_pListViewDoing->insert (QVariant::fromValue<RequestTask>(req));
619
619
switchTaskView (true );
620
620
#endif
@@ -669,7 +669,7 @@ void NetworkTool::onPutRequest()
669
669
connect (pReply, SIGNAL (requestFinished (const RequestTask &)),
670
670
this , SLOT (onRequestFinished (const RequestTask &)));
671
671
672
- #ifndef TEST_PERFORMANCE
672
+ #ifndef TEST_PERFORMANCE_NO_TASK_LIST
673
673
m_pListViewDoing->insert (QVariant::fromValue<RequestTask>(req));
674
674
switchTaskView (true );
675
675
#endif
@@ -703,7 +703,7 @@ void NetworkTool::onDeleteRequest()
703
703
connect (pReply, SIGNAL (requestFinished (const RequestTask &)),
704
704
this , SLOT (onRequestFinished (const RequestTask &)));
705
705
706
- #ifndef TEST_PERFORMANCE
706
+ #ifndef TEST_PERFORMANCE_NO_TASK_LIST
707
707
m_pListViewDoing->insert (QVariant::fromValue<RequestTask>(req));
708
708
switchTaskView (true );
709
709
#endif
@@ -737,7 +737,7 @@ void NetworkTool::onHeadRequest()
737
737
connect (pReply, SIGNAL (requestFinished (const RequestTask &)),
738
738
this , SLOT (onRequestFinished (const RequestTask &)));
739
739
740
- #ifndef TEST_PERFORMANCE
740
+ #ifndef TEST_PERFORMANCE_NO_TASK_LIST
741
741
m_pListViewDoing->insert (QVariant::fromValue<RequestTask>(req));
742
742
switchTaskView (true );
743
743
#endif
@@ -850,10 +850,8 @@ void NetworkTool::onBatchRequest()
850
850
requests.append (std::move (req));
851
851
}
852
852
853
- #ifdef TEST_PERFORMANCE
854
- for (int i = 0 ; i < TEST_PERFORMANCE_EXEC_COUNT; ++i)
853
+ for (int i = 0 ; i < BATCH_REQUEST_EXEC_COUNT; ++i)
855
854
{
856
- #endif // #ifdef TEST_PERFORMANCE
857
855
858
856
quint64 batchId;
859
857
NetworkReply *pReply = NetworkManager::globalInstance ()->addBatchRequest (requests, batchId);
@@ -865,7 +863,7 @@ void NetworkTool::onBatchRequest()
865
863
connect (pReply, SIGNAL (requestFinished (const RequestTask &)),
866
864
this , SLOT (onRequestFinished (const RequestTask &)));
867
865
868
- #ifndef TEST_PERFORMANCE
866
+ #ifndef TEST_PERFORMANCE_NO_TASK_LIST
869
867
QVector<QVariant> vec;
870
868
vec.resize (requests.size ());
871
869
int i = 0 ;
@@ -878,10 +876,7 @@ void NetworkTool::onBatchRequest()
878
876
switchTaskView (true );
879
877
#endif
880
878
}
881
-
882
- #ifdef TEST_PERFORMANCE
883
879
}
884
- #endif // #ifdef TEST_PERFORMANCE
885
880
}
886
881
887
882
// request: 任务信息
@@ -919,12 +914,12 @@ void NetworkTool::onRequestFinished(const RequestTask &request)
919
914
}
920
915
}
921
916
922
- // #ifndef TEST_PERFORMANCE
917
+ // #ifndef TEST_PERFORMANCE_NO_TASK_LIST
923
918
if (m_pListViewDoing)
924
919
{
925
920
m_pListViewDoing->onTaskFinished (request);
926
921
}
927
- // #endif // !TEST_PERFORMANCE
922
+ // #endif // !TEST_PERFORMANCE_NO_TASK_LIST
928
923
}
929
924
930
925
void NetworkTool::onBatchDownloadProgress (quint64 batchId, qint64 bytes)
0 commit comments