QHostInfo: remove unused QAbstractHostInfoLookupManager

If it was used in the past, it no longer is, and can't be, because
it's not exported.

Change-Id: Ifb9c353e756add5b57bf0c5706c075bb2eb41d83
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Marc Mutz 2019-07-04 18:27:45 +02:00
parent cab920d52c
commit 2851f6eae9
2 changed files with 10 additions and 29 deletions

View File

@ -392,7 +392,7 @@ QHostInfo QHostInfo::fromName(const QString &name)
#endif #endif
QHostInfo hostInfo = QHostInfoAgent::fromName(name); QHostInfo hostInfo = QHostInfoAgent::fromName(name);
QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager(); QHostInfoLookupManager* manager = theHostInfoLookupManager();
manager->cache.put(name, hostInfo); manager->cache.put(name, hostInfo);
return hostInfo; return hostInfo;
} }
@ -405,7 +405,7 @@ QHostInfo QHostInfoPrivate::fromName(const QString &name, QSharedPointer<QNetwor
#endif #endif
QHostInfo hostInfo = QHostInfoAgent::fromName(name, session); QHostInfo hostInfo = QHostInfoAgent::fromName(name, session);
QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager(); QHostInfoLookupManager* manager = theHostInfoLookupManager();
manager->cache.put(name, hostInfo); manager->cache.put(name, hostInfo);
return hostInfo; return hostInfo;
} }
@ -1077,7 +1077,7 @@ QHostInfo qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char
*id = -1; *id = -1;
// check cache // check cache
QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager(); QHostInfoLookupManager* manager = theHostInfoLookupManager();
if (manager && manager->cache.isEnabled()) { if (manager && manager->cache.isEnabled()) {
QHostInfo info = manager->cache.get(name, valid); QHostInfo info = manager->cache.get(name, valid);
if (*valid) { if (*valid) {
@ -1094,7 +1094,7 @@ QHostInfo qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char
void qt_qhostinfo_clear_cache() void qt_qhostinfo_clear_cache()
{ {
QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager(); QHostInfoLookupManager* manager = theHostInfoLookupManager();
if (manager) { if (manager) {
manager->clear(); manager->clear();
} }
@ -1103,7 +1103,7 @@ void qt_qhostinfo_clear_cache()
#ifdef QT_BUILD_INTERNAL #ifdef QT_BUILD_INTERNAL
void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e) void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e)
{ {
QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager(); QHostInfoLookupManager* manager = theHostInfoLookupManager();
if (manager) { if (manager) {
manager->cache.setEnabled(e); manager->cache.setEnabled(e);
} }
@ -1111,7 +1111,7 @@ void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e)
void qt_qhostinfo_cache_inject(const QString &hostname, const QHostInfo &resolution) void qt_qhostinfo_cache_inject(const QString &hostname, const QHostInfo &resolution)
{ {
QAbstractHostInfoLookupManager* manager = theHostInfoLookupManager(); QHostInfoLookupManager* manager = theHostInfoLookupManager();
if (!manager || !manager->cache.isEnabled()) if (!manager || !manager->cache.isEnabled())
return; return;
@ -1167,9 +1167,4 @@ void QHostInfoCache::clear()
cache.clear(); cache.clear();
} }
QAbstractHostInfoLookupManager* QAbstractHostInfoLookupManager::globalInstance()
{
return theHostInfoLookupManager();
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -208,30 +208,14 @@ public:
}; };
class QAbstractHostInfoLookupManager : public QObject class QHostInfoLookupManager : public QObject
{
Q_OBJECT
public:
~QAbstractHostInfoLookupManager() {}
virtual void clear() = 0;
QHostInfoCache cache;
protected:
QAbstractHostInfoLookupManager() {}
static QAbstractHostInfoLookupManager* globalInstance();
};
class QHostInfoLookupManager : public QAbstractHostInfoLookupManager
{ {
Q_OBJECT Q_OBJECT
public: public:
QHostInfoLookupManager(); QHostInfoLookupManager();
~QHostInfoLookupManager(); ~QHostInfoLookupManager();
void clear() override; void clear();
// called from QHostInfo // called from QHostInfo
void scheduleLookup(QHostInfoRunnable *r); void scheduleLookup(QHostInfoRunnable *r);
@ -241,6 +225,8 @@ public:
void lookupFinished(QHostInfoRunnable *r); void lookupFinished(QHostInfoRunnable *r);
bool wasAborted(int id); bool wasAborted(int id);
QHostInfoCache cache;
friend class QHostInfoRunnable; friend class QHostInfoRunnable;
protected: protected:
#if QT_CONFIG(thread) #if QT_CONFIG(thread)