[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:13:52 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 40ef85fe1673a670c8829b76cdb2d24271ecc7ab
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 19 18:55:18 2003 +0000

            Reviewed by Darin.
    
    	- fixed 3488883 - KIO::TransferJob needs to really use signals instead of calling loader directly
    
    	* khtml/khtml_part.cpp:
            (KHTMLPart::openURL):
            * khtml/misc/loader.cpp:
            (Loader::servePendingRequests):
            (Loader::slotReceivedResponse):
            * khtml/misc/loader.h:
            * kwq/KWQKJobClasses.h:
            * kwq/KWQKJobClasses.mm:
            (KIO::TransferJob::TransferJob):
            (KIO::TransferJob::url):
            (KIO::TransferJob::emitData):
            (KIO::TransferJob::emitRedirection):
            (KIO::TransferJob::emitResult):
            (KIO::TransferJob::emitReceivedResponse):
            * kwq/KWQLoader.mm:
            (KWQServeRequest):
            * kwq/KWQObject.mm:
            (QObject::connect):
            * kwq/KWQResourceLoader.h:
            * kwq/KWQResourceLoader.mm:
            (-[KWQResourceLoader receivedResponse:]):
            (-[KWQResourceLoader addData:]):
            (-[KWQResourceLoader finishJobAndHandle]):
            * kwq/KWQSignal.h:
            * kwq/KWQSignal.mm:
            (KWQSignal::call):
            * kwq/KWQSlot.h:
            * kwq/KWQSlot.mm:
            (KWQSlot::KWQSlot):
            (KWQSlot::call):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5584 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 34785d0..35870d3 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,40 @@
+2003-11-18  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Darin.
+
+	- fixed 3488883 - KIO::TransferJob needs to really use signals instead of calling loader directly
+        
+	* khtml/khtml_part.cpp:
+        (KHTMLPart::openURL):
+        * khtml/misc/loader.cpp:
+        (Loader::servePendingRequests):
+        (Loader::slotReceivedResponse):
+        * khtml/misc/loader.h:
+        * kwq/KWQKJobClasses.h:
+        * kwq/KWQKJobClasses.mm:
+        (KIO::TransferJob::TransferJob):
+        (KIO::TransferJob::url):
+        (KIO::TransferJob::emitData):
+        (KIO::TransferJob::emitRedirection):
+        (KIO::TransferJob::emitResult):
+        (KIO::TransferJob::emitReceivedResponse):
+        * kwq/KWQLoader.mm:
+        (KWQServeRequest):
+        * kwq/KWQObject.mm:
+        (QObject::connect):
+        * kwq/KWQResourceLoader.h:
+        * kwq/KWQResourceLoader.mm:
+        (-[KWQResourceLoader receivedResponse:]):
+        (-[KWQResourceLoader addData:]):
+        (-[KWQResourceLoader finishJobAndHandle]):
+        * kwq/KWQSignal.h:
+        * kwq/KWQSignal.mm:
+        (KWQSignal::call):
+        * kwq/KWQSlot.h:
+        * kwq/KWQSlot.mm:
+        (KWQSlot::KWQSlot):
+        (KWQSlot::call):
+
 2003-11-18  David Hyatt  <hyatt at apple.com>
 
 	Fix for 3488244, marquee-increments with percentage values not handled correctly.  Also added a tweak to ensure
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 1f0844f..35cb283 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -480,8 +480,10 @@ bool KHTMLPart::openURL( const KURL &url )
 
   connect( d->m_job, SIGNAL( result( KIO::Job * ) ),
            SLOT( slotFinished( KIO::Job * ) ) );
+#if !APPLE_CHANGES
   connect( d->m_job, SIGNAL( data( KIO::Job*, const QByteArray &)),
            SLOT( slotData( KIO::Job*, const QByteArray &)));
+#endif
 
   connect( d->m_job, SIGNAL(redirection(KIO::Job*, const KURL&) ),
            SLOT( slotRedirection(KIO::Job*,const KURL&) ) );
diff --git a/WebCore/khtml/misc/loader.cpp b/WebCore/khtml/misc/loader.cpp
index 3092c34..97818c2 100644
--- a/WebCore/khtml/misc/loader.cpp
+++ b/WebCore/khtml/misc/loader.cpp
@@ -1227,13 +1227,18 @@ void Loader::servePendingRequests()
   }
 
   connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotFinished( KIO::Job * ) ) );
-  connect( job, SIGNAL( data( KIO::Job*, const QByteArray &)),
-           SLOT( slotData( KIO::Job*, const QByteArray &)));
 
 #if APPLE_CHANGES
+  connect( job, SIGNAL( data( KIO::Job*, const char *, int)),
+           SLOT( slotData( KIO::Job*, const char *, int)));
+  connect( job, SIGNAL( receivedResponse( KIO::Job *, void *)), SLOT( slotReceivedResponse( KIO::Job *, void *)) );
+
   if (KWQServeRequest(this, req, job))
       m_requestsLoading.insert(job, req);
 #else
+  connect( job, SIGNAL( data( KIO::Job*, const QByteArray &)),
+           SLOT( slotData( KIO::Job*, const QByteArray &)));
+
   if ( req->object->schedule() )
       KIO::Scheduler::scheduleJob( job );
 
@@ -1283,7 +1288,7 @@ kdDebug(6060) << "Loader::slotFinished, url = " << j->url().url() << " expires "
 }
 
 #if APPLE_CHANGES
-void Loader::receivedResponse(KIO::Job* job, void *response)
+void Loader::slotReceivedResponse(KIO::Job* job, void *response)
 {
     Request *r = m_requestsLoading[job];
     ASSERT(r);
diff --git a/WebCore/khtml/misc/loader.h b/WebCore/khtml/misc/loader.h
index 820eaa6..ff26696 100644
--- a/WebCore/khtml/misc/loader.h
+++ b/WebCore/khtml/misc/loader.h
@@ -449,7 +449,7 @@ namespace khtml
 	void slotFinished( KIO::Job * );
 #if APPLE_CHANGES
 	void slotData( KIO::Job *, const char *data, int size );
-        void receivedResponse ( KIO::Job *, void *response );
+        void slotReceivedResponse ( KIO::Job *, void *response );
 #else
 	void slotData( KIO::Job *, const QByteArray & );
 #endif
diff --git a/WebCore/kwq/KWQKJobClasses.h b/WebCore/kwq/KWQKJobClasses.h
index 03c91a7..f59d8ea 100644
--- a/WebCore/kwq/KWQKJobClasses.h
+++ b/WebCore/kwq/KWQKJobClasses.h
@@ -68,8 +68,18 @@ public:
     
     KURL url() const;
 
+    void emitData(const char *, int);
+    void emitRedirection(const KURL &);
+    void emitResult();
+    void emitReceivedResponse(void *);
+
 private:
     TransferJobPrivate *d;
+
+    KWQSignal m_data;
+    KWQSignal m_redirection;
+    KWQSignal m_result;
+    KWQSignal m_receivedResponse;
 };
 
 } // namespace KIO
diff --git a/WebCore/kwq/KWQKJobClasses.mm b/WebCore/kwq/KWQKJobClasses.mm
index 001055a..693aac2 100644
--- a/WebCore/kwq/KWQKJobClasses.mm
+++ b/WebCore/kwq/KWQKJobClasses.mm
@@ -61,13 +61,21 @@ public:
 };
 
 TransferJob::TransferJob(const KURL &url, bool reload, bool showProgressInfo)
+    : d(new TransferJobPrivate(url)),
+      m_data(this, SIGNAL(data(KIO::Job*, const char*, int))),
+      m_redirection(this, SIGNAL(redirection(KIO::Job*, const KURL&))),
+      m_result(this, SIGNAL(result(KIO::Job*))),
+      m_receivedResponse(this, SIGNAL(receivedResponse(KIO::Job*, void *)))
 {
-    d = new TransferJobPrivate(url);
 }
 
 TransferJob::TransferJob(const KURL &url, const QByteArray &postData, bool showProgressInfo)
+    : d(new TransferJobPrivate(url)),
+      m_data(this, SIGNAL(data(KIO::Job*, const char*, int))),
+      m_redirection(this, SIGNAL(redirection(KIO::Job*, const KURL&))),
+      m_result(this, SIGNAL(result(KIO::Job*))),
+      m_receivedResponse(this, SIGNAL(receivedResponse(KIO::Job*, void *)))
 {
-    d = new TransferJobPrivate(url);
 }
 
 TransferJob::~TransferJob()
@@ -138,4 +146,24 @@ KURL TransferJob::url() const
     return d->URL;
 }
 
+void TransferJob::emitData(const char *data, int size)
+{
+    m_data.call(this, data, size);
+}
+
+void TransferJob::emitRedirection(const KURL &url)
+{
+    m_redirection.call(this, url);
+}
+
+void TransferJob::emitResult()
+{
+    m_result.call(this);
+}
+
+void TransferJob::emitReceivedResponse(void *response)
+{
+    m_receivedResponse.call(this, response);
+}
+
 } // namespace KIO
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index 1ece98f..daff1cd 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -53,7 +53,7 @@ bool KWQServeRequest(Loader *loader, Request *request, TransferJob *job)
     part->didTellBridgeAboutLoad(request->object->url().string());
 
     KWQ_BLOCK_EXCEPTIONS;
-    KWQResourceLoader *resourceLoader = [[KWQResourceLoader alloc] initWithLoader:loader job:job];
+    KWQResourceLoader *resourceLoader = [[KWQResourceLoader alloc] initWithJob:job];
     id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader withURL:job->url().getNSURL()];
     [resourceLoader setHandle:handle];
     [resourceLoader release];
diff --git a/WebCore/kwq/KWQObject.mm b/WebCore/kwq/KWQObject.mm
index 79551f7..d9222d4 100644
--- a/WebCore/kwq/KWQObject.mm
+++ b/WebCore/kwq/KWQObject.mm
@@ -74,12 +74,9 @@ void QObject::connect(const QObject *sender, const char *signalName, const QObje
 #if !ERROR_DISABLED
         if (1
             && !KWQNamesMatch(member, SIGNAL(setStatusBarText(const QString &)))
-            && !KWQNamesMatch(member, SLOT(slotData(KIO::Job *, const QByteArray &)))
-            && !KWQNamesMatch(member, SLOT(slotFinished(KIO::Job *)))
             && !KWQNamesMatch(member, SLOT(slotHistoryChanged()))
             && !KWQNamesMatch(member, SLOT(slotJobPercent(KIO::Job *, unsigned long)))
             && !KWQNamesMatch(member, SLOT(slotJobSpeed(KIO::Job *, unsigned long)))
-            && !KWQNamesMatch(member, SLOT(slotRedirection(KIO::Job *, const KURL &))) // FIXME: Should implement this one?
             && !KWQNamesMatch(member, SLOT(slotScrollBarMoved()))
             && !KWQNamesMatch(member, SLOT(slotShowDocument(const QString &, const QString &)))
             && !KWQNamesMatch(member, SLOT(slotViewCleared())) // FIXME: Should implement this one!
diff --git a/WebCore/kwq/KWQResourceLoader.h b/WebCore/kwq/KWQResourceLoader.h
index 1e80915..84021c0 100644
--- a/WebCore/kwq/KWQResourceLoader.h
+++ b/WebCore/kwq/KWQResourceLoader.h
@@ -35,12 +35,11 @@ namespace KIO {
 
 @interface KWQResourceLoader : NSObject <WebCoreResourceLoader>
 {
-    khtml::Loader *_loader;
     KIO::TransferJob *_job;
     id <WebCoreResourceHandle> _handle;
 }
 
-- (id)initWithLoader:(khtml::Loader *)loader job:(KIO::TransferJob *)job;
+- (id)initWithJob:(KIO::TransferJob *)job;
 - (void)setHandle:(id <WebCoreResourceHandle>)handle;
 - (void)jobWillBeDeallocated;
 
diff --git a/WebCore/kwq/KWQResourceLoader.mm b/WebCore/kwq/KWQResourceLoader.mm
index 40d9c0e..ec9b077 100644
--- a/WebCore/kwq/KWQResourceLoader.mm
+++ b/WebCore/kwq/KWQResourceLoader.mm
@@ -34,11 +34,10 @@ using KIO::TransferJob;
 
 @implementation KWQResourceLoader
 
-- (id)initWithLoader:(Loader *)loader job:(TransferJob *)job;
+- (id)initWithJob:(TransferJob *)job;
 {
     [super init];
 
-    _loader = loader;
     _job = job;
 
     job->setLoader(self);
@@ -55,17 +54,15 @@ using KIO::TransferJob;
 - (void)receivedResponse:(id)response
 {
     ASSERT(response);
-    ASSERT(_loader);
     ASSERT(_job);
-    _loader->receivedResponse(_job, response);
+    _job->emitReceivedResponse(response);
 }
 
 - (void)addData:(NSData *)data
 {
     ASSERT(data);
-    ASSERT(_loader);
     ASSERT(_job);
-    _loader->slotData(_job, (const char *)[data bytes], [data length]);
+    _job->emitData((const char *)[data bytes], [data length]);
 }
 
 - (void)jobWillBeDeallocated
@@ -86,7 +83,7 @@ using KIO::TransferJob;
     _handle = nil;
 
     if (job) {
-        _loader->slotFinished(job);
+        job->emitResult();
     }
     delete job;
     [handle release];
diff --git a/WebCore/kwq/KWQSignal.h b/WebCore/kwq/KWQSignal.h
index 8a2cb0a..bdf56c7 100644
--- a/WebCore/kwq/KWQSignal.h
+++ b/WebCore/kwq/KWQSignal.h
@@ -43,7 +43,10 @@ public:
     void call(const QString &) const;
     void call(KIO::Job *) const;
     void call(khtml::DocLoader *, khtml::CachedObject *) const;
-
+    void call(KIO::Job *, const char *data, int size) const;
+    void call(KIO::Job *, const KURL &) const;
+    void call(KIO::Job *, void *) const;
+    
 private:
     // forbid copying and assignment
     KWQSignal(const KWQSignal &);
diff --git a/WebCore/kwq/KWQSignal.mm b/WebCore/kwq/KWQSignal.mm
index 08e0898..8b6196e 100644
--- a/WebCore/kwq/KWQSignal.mm
+++ b/WebCore/kwq/KWQSignal.mm
@@ -148,3 +148,40 @@ void KWQSignal::call(DocLoader *l, CachedObject *o) const
         }
     }
 }
+
+void KWQSignal::call(Job *j, const char *d, int s) const
+{
+    if (!_object->_signalsBlocked) {
+        KWQObjectSenderScope senderScope(_object);
+        QValueList<KWQSlot> copiedSlots(_slots);
+        QValueListConstIterator<KWQSlot> end = copiedSlots.end();
+        for (QValueListConstIterator<KWQSlot> it = copiedSlots.begin(); it != end; ++it) {
+            (*it).call(j, d, s);
+        }
+    }
+}
+
+void KWQSignal::call(Job *j, const KURL &u) const
+{
+    if (!_object->_signalsBlocked) {
+        KWQObjectSenderScope senderScope(_object);
+        QValueList<KWQSlot> copiedSlots(_slots);
+        QValueListConstIterator<KWQSlot> end = copiedSlots.end();
+        for (QValueListConstIterator<KWQSlot> it = copiedSlots.begin(); it != end; ++it) {
+            (*it).call(j, u);
+        }
+    }
+}
+
+void KWQSignal::call(Job *j, void *d) const
+{
+    if (!_object->_signalsBlocked) {
+        KWQObjectSenderScope senderScope(_object);
+        QValueList<KWQSlot> copiedSlots(_slots);
+        QValueListConstIterator<KWQSlot> end = copiedSlots.end();
+        for (QValueListConstIterator<KWQSlot> it = copiedSlots.begin(); it != end; ++it) {
+            (*it).call(j, d);
+        }
+    }
+}
+
diff --git a/WebCore/kwq/KWQSlot.h b/WebCore/kwq/KWQSlot.h
index f1cd2c3..3e79b3c 100644
--- a/WebCore/kwq/KWQSlot.h
+++ b/WebCore/kwq/KWQSlot.h
@@ -29,6 +29,7 @@
 #include "KWQGuardedPtr.h"
 
 class QString;
+class KURL;
 
 namespace KIO {
     class Job;
@@ -56,7 +57,10 @@ public:
     void call(const QString &) const;
     void call(KIO::Job *) const;
     void call(khtml::DocLoader *, khtml::CachedObject *) const;
-    
+    void call(KIO::Job *, const char *, int) const;
+    void call(KIO::Job *, const KURL &) const;
+    void call(KIO::Job *, void *) const;
+
     friend bool operator==(const KWQSlot &, const KWQSlot &);
 
 private:
diff --git a/WebCore/kwq/KWQSlot.mm b/WebCore/kwq/KWQSlot.mm
index 1c90438..4bd20af 100644
--- a/WebCore/kwq/KWQSlot.mm
+++ b/WebCore/kwq/KWQSlot.mm
@@ -36,6 +36,7 @@
 using DOM::DocumentImpl;
 using khtml::CachedObject;
 using khtml::DocLoader;
+using khtml::Loader;
 using khtml::RenderCheckBox;
 using khtml::RenderFileButton;
 using khtml::RenderFormElement;
@@ -66,9 +67,15 @@ enum FunctionNumber {
     slotStateChanged,
     slotSubmitFormAgain,
     slotTextChanged,
-    slotTextChangedWithString,
+    slotTextChangedWithString_RenderLineEdit,
+    slotTextChangedWithString_RenderFileButton,
     slotValueChanged,
-    slotWidgetDestructed
+    slotWidgetDestructed,
+    slotData,
+    slotRedirection,
+    slotFinished_KHTMLPart,
+    slotFinished_Loader,
+    slotReceivedResponse
 };
 
 KWQSlot::KWQSlot(QObject *object, const char *member)
@@ -95,7 +102,7 @@ KWQSlot::KWQSlot(QObject *object, const char *member)
     CASE(slotTextChanged, (), RenderTextArea)
     CASE(slotValueChanged, (int), RenderScrollMediator)
     CASE(slotWidgetDestructed, (), RenderWidget)
-        
+       
     #undef CASE
 
     if (KWQNamesMatch(member, SIGNAL(finishedParsing()))) {
@@ -112,7 +119,27 @@ KWQSlot::KWQSlot(QObject *object, const char *member)
         m_function = slotSubmitFormAgain;
     } else if (KWQNamesMatch(member, SLOT(slotTextChanged(const QString &)))) {
         ASSERT(dynamic_cast<RenderLineEdit *>(object) || dynamic_cast<RenderFileButton *>(object));
-        m_function = slotTextChangedWithString;
+	if (dynamic_cast<RenderLineEdit *>(object)) {
+	    m_function = slotTextChangedWithString_RenderLineEdit;
+	} else {
+	    m_function = slotTextChangedWithString_RenderFileButton;
+	}
+    } else if (KWQNamesMatch(member, SLOT(slotData(KIO::Job *, const char *, int)))) {
+	ASSERT(dynamic_cast<khtml::Loader *>(object));
+	m_function = slotData;
+    } else if (KWQNamesMatch(member, SLOT(slotRedirection(KIO::Job *, const KURL&)))) {
+	ASSERT(dynamic_cast<KHTMLPart *>(object));
+	m_function = slotRedirection;
+    } else if (KWQNamesMatch(member, SLOT(slotFinished(KIO::Job *)))) {
+	ASSERT(dynamic_cast<khtml::Loader *>(object) || dynamic_cast<KHTMLPart *>(object));
+	if (dynamic_cast<khtml::Loader *>(object)) {
+	    m_function = slotFinished_Loader;
+	} else {
+	    m_function = slotFinished_KHTMLPart;
+	}
+    } else if (KWQNamesMatch(member, SLOT(slotReceivedResponse(KIO::Job *, void *)))) {
+	ASSERT(dynamic_cast<khtml::Loader *>(object));
+	m_function = slotReceivedResponse;
     } else {
         ERROR("trying to create a slot for unknown member %s", member);
         return;
@@ -199,17 +226,12 @@ void KWQSlot::call(const QString &string) const
     }
     
     switch (m_function) {
-        case slotTextChangedWithString: {
-            RenderLineEdit *edit = dynamic_cast<RenderLineEdit *>(m_object.pointer());
-            if (edit) {
-                edit->slotTextChanged(string);
-            }
-            RenderFileButton *button = dynamic_cast<RenderFileButton *>(m_object.pointer());
-            if (button) {
-                button->slotTextChanged(string);
-            }
+        case slotTextChangedWithString_RenderLineEdit:
+            static_cast<RenderLineEdit *>(m_object.pointer())->slotTextChanged(string);
+	    return;
+        case slotTextChangedWithString_RenderFileButton:
+            static_cast<RenderFileButton *>(m_object.pointer())->slotTextChanged(string);
             return;
-        }
     }
     
     call();
@@ -225,11 +247,62 @@ void KWQSlot::call(Job *job) const
         case slotChildStarted:
             static_cast<KHTMLPart *>(m_object.pointer())->slotChildStarted(job);
             return;
+        case slotFinished_KHTMLPart:
+            static_cast<KHTMLPart *>(m_object.pointer())->slotFinished(job);
+            return;
+        case slotFinished_Loader:
+            static_cast<Loader *>(m_object.pointer())->slotFinished(job);
+            return;
     }
     
     call();
 }
 
+void KWQSlot::call(Job *job, const char *data, int size) const
+{
+    if (m_object.isNull()) {
+        return;
+    }
+    
+    switch (m_function) {
+        case slotData:
+	    static_cast<Loader *>(m_object.pointer())->slotData(job, data, size);
+	    return;
+    }
+
+    call();
+}
+
+void KWQSlot::call(Job *job, const KURL &url) const
+{
+    if (m_object.isNull()) {
+        return;
+    }
+    
+    switch (m_function) {
+        case slotRedirection:
+	    static_cast<KHTMLPart *>(m_object.pointer())->slotRedirection(job, url);
+	    return;
+    }
+
+    call();
+}
+
+void KWQSlot::call(KIO::Job *job, void *response) const
+{
+    if (m_object.isNull()) {
+        return;
+    }
+    
+    switch (m_function) {
+        case slotReceivedResponse:
+	    static_cast<Loader *>(m_object.pointer())->slotReceivedResponse(job, response);
+	    return;
+    }
+
+    call();
+}
+
 void KWQSlot::call(DocLoader *loader, CachedObject *cachedObject) const
 {
     if (m_object.isNull()) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list