summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/network/qt
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-13 16:23:25 +0100
committerBen Murdoch <benm@google.com>2011-05-16 11:35:02 +0100
commit65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch)
treef478babb801e720de7bfaee23443ffe029f58731 /Source/WebCore/platform/network/qt
parent47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff)
downloadexternal_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebCore/platform/network/qt')
-rw-r--r--Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp4
-rw-r--r--Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.cpp28
-rw-r--r--Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.h44
3 files changed, 43 insertions, 33 deletions
diff --git a/Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp b/Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
index 959e74a..f3e7023 100644
--- a/Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
+++ b/Source/WebCore/platform/network/qt/NetworkStateNotifierQt.cpp
@@ -91,6 +91,6 @@ void NetworkStateNotifier::setNetworkAccessAllowed(bool isAllowed)
} // namespace WebCore
-#endif
-
#include "moc_NetworkStateNotifierPrivate.cpp"
+
+#endif
diff --git a/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.cpp b/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.cpp
index 0caeb05..e0d6e69 100644
--- a/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.cpp
+++ b/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.cpp
@@ -25,10 +25,6 @@
#include <QNetworkCookieJar>
#include <QStringList>
-// Use unused variables to be able to call qRegisterMetaType statically.
-static int dummyStaticVar1 = qRegisterMetaType<QFutureInterface<bool> >("QFutureInterface<bool>");
-static int dummyStaticVar2 = qRegisterMetaType<QFutureInterface<QList<QNetworkCookie> > >("QFutureInterface<QList<QNetworkCookie> >");
-
namespace WebCore {
QtNAMThreadSafeProxy::QtNAMThreadSafeProxy(QNetworkAccessManager *manager)
@@ -37,8 +33,8 @@ QtNAMThreadSafeProxy::QtNAMThreadSafeProxy(QNetworkAccessManager *manager)
moveToThread(manager->thread());
connect(this, SIGNAL(localSetCookiesRequested(const QUrl&, const QString&)), SLOT(localSetCookies(const QUrl&, const QString&)));
- connect(this, SIGNAL(localCookiesForUrlRequested(QFutureInterface<QList<QNetworkCookie> >, const QUrl&)), SLOT(localCookiesForUrl(QFutureInterface<QList<QNetworkCookie> >, const QUrl&)));
- connect(this, SIGNAL(localWillLoadFromCacheRequested(QFutureInterface<bool>, const QUrl&)), SLOT(localWillLoadFromCache(QFutureInterface<bool>, const QUrl&)));
+ connect(this, SIGNAL(localCookiesForUrlRequested(const QUrl&, bool*, QList<QNetworkCookie>*)), SLOT(localCookiesForUrl(const QUrl&, bool*, QList<QNetworkCookie>*)));
+ connect(this, SIGNAL(localWillLoadFromCacheRequested(const QUrl&, bool*, bool*)), SLOT(localWillLoadFromCache(const QUrl&, bool*, bool*)));
}
void QtNAMThreadSafeProxy::localSetCookies(const QUrl& url, const QString& cookies)
@@ -54,19 +50,23 @@ void QtNAMThreadSafeProxy::localSetCookies(const QUrl& url, const QString& cooki
m_manager->cookieJar()->setCookiesFromUrl(cookieList, url);
}
-void QtNAMThreadSafeProxy::localCookiesForUrl(QFutureInterface<QList<QNetworkCookie> > fi, const QUrl& url)
+void QtNAMThreadSafeProxy::localCookiesForUrl(const QUrl& url, bool* done, QList<QNetworkCookie>* result)
{
- fi.reportResult(m_manager->cookieJar()->cookiesForUrl(url));
- fi.reportFinished();
+ QMutexLocker lock(&m_resultMutex);
+ *result = m_manager->cookieJar()->cookiesForUrl(url);
+ *done = true;
+ m_resultWaitCondition.wakeAll();
}
-void QtNAMThreadSafeProxy::localWillLoadFromCache(QFutureInterface<bool> fi, const QUrl& url)
+void QtNAMThreadSafeProxy::localWillLoadFromCache(const QUrl& url, bool* done, bool* result)
{
- bool retVal = false;
+ QMutexLocker lock(&m_resultMutex);
if (m_manager->cache())
- retVal = m_manager->cache()->metaData(url).isValid();
-
- fi.reportFinished(&retVal);
+ *result = m_manager->cache()->metaData(url).isValid();
+ else
+ *result = false;
+ *done = true;
+ m_resultWaitCondition.wakeAll();
}
QtNetworkReplyThreadSafeProxy::QtNetworkReplyThreadSafeProxy(QNetworkAccessManager *manager)
diff --git a/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.h b/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.h
index a2fa4ee..ae963cf 100644
--- a/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.h
+++ b/Source/WebCore/platform/network/qt/QtNAMThreadSafeProxy.h
@@ -19,11 +19,11 @@
#ifndef QtNAMThreadSafeProxy_h
#define QtNAMThreadSafeProxy_h
-#include <QFuture>
#include <QMutex>
#include <QNetworkCookie>
#include <QNetworkReply>
#include <QObject>
+#include <QWaitCondition>
QT_BEGIN_NAMESPACE
class QNetworkAccessManager;
@@ -43,34 +43,44 @@ public:
emit localSetCookiesRequested(url, cookies);
}
- QFuture<QList<QNetworkCookie> > cookiesForUrl(const QUrl& url)
+ QList<QNetworkCookie> cookiesForUrl(const QUrl& url)
{
- QFutureInterface<QList<QNetworkCookie> > fi;
- fi.reportStarted();
- emit localCookiesForUrlRequested(fi, url);
- return fi.future();
+ bool done = false;
+ QList<QNetworkCookie> result;
+ emit localCookiesForUrlRequested(url, &done, &result);
+
+ QMutexLocker lock(&m_resultMutex);
+ while (!done)
+ m_resultWaitCondition.wait(&m_resultMutex);
+ return result;
}
- QFuture<bool> willLoadFromCache(const QUrl& url)
+ bool willLoadFromCache(const QUrl& url)
{
- QFutureInterface<bool> fi;
- fi.reportStarted();
- emit localWillLoadFromCacheRequested(fi, url);
- return fi.future();
+ bool done = false;
+ bool result;
+ emit localWillLoadFromCacheRequested(url, &done, &result);
+
+ QMutexLocker lock(&m_resultMutex);
+ while (!done)
+ m_resultWaitCondition.wait(&m_resultMutex);
+ return result;
}
signals:
- void localSetCookiesRequested(const QUrl& url, const QString& cookies);
- void localCookiesForUrlRequested(QFutureInterface<QList<QNetworkCookie> > fi, const QUrl& url);
- void localWillLoadFromCacheRequested(QFutureInterface<bool> fi, const QUrl& url);
+ void localSetCookiesRequested(const QUrl&, const QString& cookies);
+ void localCookiesForUrlRequested(const QUrl&, bool* done, QList<QNetworkCookie>* result);
+ void localWillLoadFromCacheRequested(const QUrl&, bool* done, bool* result);
private slots:
- void localSetCookies(const QUrl& url, const QString& cookies);
- void localCookiesForUrl(QFutureInterface<QList<QNetworkCookie> > fi, const QUrl& url);
- void localWillLoadFromCache(QFutureInterface<bool> fi, const QUrl& url);
+ void localSetCookies(const QUrl&, const QString& cookies);
+ void localCookiesForUrl(const QUrl&, bool* done, QList<QNetworkCookie>* result);
+ void localWillLoadFromCache(const QUrl&, bool* done, bool* result);
private:
QNetworkAccessManager* m_manager;
+ QMutex m_resultMutex;
+ QWaitCondition m_resultWaitCondition;
};