[Qt][WK2] QtFileDownloader ctor shouldn't call QtFileDownloader::onReadyRead()
authorjesus@webkit.org <jesus@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Sep 2011 15:06:36 +0000 (15:06 +0000)
committerjesus@webkit.org <jesus@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Sep 2011 15:06:36 +0000 (15:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68696

Reviewed by Andreas Kling.

Instead of connecting signals and calling QtFileDownloader::onReadyRead()
on its constructor, QtFileDownloader will now handle this in start().

* WebProcess/Downloads/qt/DownloadQt.cpp:
(WebKit::Download::start):
* WebProcess/Downloads/qt/QtFileDownloader.cpp:
(WebKit::QtFileDownloader::QtFileDownloader):
(WebKit::QtFileDownloader::start):
* WebProcess/Downloads/qt/QtFileDownloader.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95804 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp
Source/WebKit2/WebProcess/Downloads/qt/QtFileDownloader.cpp
Source/WebKit2/WebProcess/Downloads/qt/QtFileDownloader.h

index c828d50..27dbd7f 100644 (file)
@@ -1,3 +1,20 @@
+2011-09-23  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        [Qt][WK2] QtFileDownloader ctor shouldn't call QtFileDownloader::onReadyRead()
+        https://bugs.webkit.org/show_bug.cgi?id=68696
+
+        Reviewed by Andreas Kling.
+
+        Instead of connecting signals and calling QtFileDownloader::onReadyRead()
+        on its constructor, QtFileDownloader will now handle this in start().
+
+        * WebProcess/Downloads/qt/DownloadQt.cpp:
+        (WebKit::Download::start):
+        * WebProcess/Downloads/qt/QtFileDownloader.cpp:
+        (WebKit::QtFileDownloader::QtFileDownloader):
+        (WebKit::QtFileDownloader::start):
+        * WebProcess/Downloads/qt/QtFileDownloader.h:
+
 2011-09-22  Gopal Raghavan  <gopal.1.raghavan@nokia.com>
 
         [Qt] TouchWebView load test not running
index 5b8ff29..9ee9995 100644 (file)
@@ -46,6 +46,7 @@ void Download::start(WebPage* initiatingWebPage)
     ASSERT(!m_qtDownloader);
 
     m_qtDownloader = new QtFileDownloader(this, adoptPtr(manager->get(m_request.toNetworkRequest())));
+    m_qtDownloader->start();
 }
 
 void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceRequest& initialRequest, const ResourceResponse& resp)
index d04db05..c936b08 100644 (file)
@@ -43,12 +43,6 @@ QtFileDownloader::QtFileDownloader(Download* download, PassOwnPtr<QNetworkReply>
     , m_error(QNetworkReply::NoError)
     , m_headersRead(false)
 {
-    connect(m_reply.get(), SIGNAL(readyRead()), SLOT(onReadyRead()));
-    connect(m_reply.get(), SIGNAL(finished()), SLOT(onFinished()));
-    connect(m_reply.get(), SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError)));
-
-    // Call onReadyRead just in case some data is already waiting.
-    onReadyRead();
 }
 
 QtFileDownloader::~QtFileDownloader()
@@ -59,6 +53,16 @@ QtFileDownloader::~QtFileDownloader()
     abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorAborted);
 }
 
+void QtFileDownloader::start()
+{
+    connect(m_reply.get(), SIGNAL(readyRead()), SLOT(onReadyRead()));
+    connect(m_reply.get(), SIGNAL(finished()), SLOT(onFinished()));
+    connect(m_reply.get(), SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError)));
+
+    // Call onReadyRead just in case some data is already waiting.
+    onReadyRead();
+}
+
 void QtFileDownloader::determineFilename()
 {
     ASSERT(!m_destinationFile);
index 7938c1e..b6b8ba2 100644 (file)
@@ -46,6 +46,7 @@ public:
     virtual ~QtFileDownloader();
     void decidedDestination(const QString& decidedFilePath, bool allowOverwrite);
     void cancel();
+    void start();
 
     enum DownloadError {
         DownloadErrorAborted = 0,