[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Patch KIO::AccessManager
From:       "Dawit A." <adawit () kde ! org>
Date:       2009-08-16 12:31:01
Message-ID: 200908160831.01368.adawit () kde ! org
[Download RAW message or body]

The attached patch changes KIO::AccessManager to schedule all the job requests 
it receives to prevent the explosion of kio_http process that can get spawned 
when many requests are made by an application all at once, e.g. rendering any 
moderately complex site.

You can easily see this by using the webkitpart in Konqueror and visiting any 
moderately complex site. For example, before the patch visiting 
qt.nokia.com/developer spawns 21 kio_http processes where as only 2 are 
spawned with the patch. Actually the scheduler always seems to spawn only 2 
processes per site. 

["accessmanager.patch" (text/x-patch)]

Index: /home/dalemayehu/work/KDE/source/branches/kdelibs/kio/kio/accessmanager.cpp
===================================================================
--- /home/dalemayehu/work/KDE/source/branches/kdelibs/kio/kio/accessmanager.cpp	(revision \
                1011399)
+++ /home/dalemayehu/work/KDE/source/branches/kdelibs/kio/kio/accessmanager.cpp	(working \
copy) @@ -30,6 +30,7 @@
 
 #include <kdebug.h>
 #include <kio/job.h>
+#include <KDE/KIO/Scheduler>
 
 namespace KIO {
 
@@ -67,7 +68,7 @@
 
 QNetworkReply *AccessManager::createRequest(Operation op, const QNetworkRequest \
&req, QIODevice *outgoingData)  {
-    KIO::Job *kioJob = 0;
+    KIO::SimpleJob *kioJob = 0;
 
     if ( !d->externalContentAllowed && req.url().scheme() != "file" && \
!req.url().scheme().isEmpty() ) {  kDebug() << "Blocked: " << req.url().scheme() <<  \
req.url(); @@ -109,6 +110,7 @@
             return 0;
     }
 
+    KIO::Scheduler::scheduleJob(kioJob);
     KDEPrivate::AccessManagerReply *reply = new KDEPrivate::AccessManagerReply(op, \
req, kioJob, this);  
     kioJob->addMetaData(d->metaDataForRequest(req));



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic