From 9d10ca5c2f41010fe9e643d87738140935d4a7a5 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Sun, 8 May 2022 16:44:59 +0800 Subject: [PATCH] opt: remove useless code the mdx**runnable class is useless now ,can be removed. --- mdx.cc | 64 +--------------------------------------------------------- 1 file changed, 1 insertion(+), 63 deletions(-) diff --git a/mdx.cc b/mdx.cc index 532c9649..69271c86 100644 --- a/mdx.cc +++ b/mdx.cc @@ -345,7 +345,6 @@ private: friend class MdxHeadwordsRequest; friend class MdxArticleRequest; friend class MddResourceRequest; - friend class MdxDeferredInitRunnable; }; MdxRegex MdxDictionary::mdxRx; @@ -567,33 +566,8 @@ sptr< Dictionary::DataRequest > MdxDictionary::getSearchResults( QString const & /// MdxDictionary::getArticle -class MdxArticleRequest; - -class MdxArticleRequestRunnable: public QRunnable -{ - MdxArticleRequest & r; - QSemaphore & hasExited; - -public: - - MdxArticleRequestRunnable( MdxArticleRequest & r_, - QSemaphore & hasExited_ ): - r( r_ ), - hasExited( hasExited_ ) - {} - - ~MdxArticleRequestRunnable() - { - hasExited.release(); - } - - virtual void run(); -}; - class MdxArticleRequest: public Dictionary::DataRequest { - friend class MdxArticleRequestRunnable; - wstring word; vector< wstring > alts; MdxDictionary & dict; @@ -613,7 +587,6 @@ public: dict( dict_ ), ignoreDiacritics( ignoreDiacritics_ ) { - // QThreadPool::globalInstance()->start( new MdxArticleRequestRunnable( *this, hasExited ) ); QThreadPool::globalInstance()->start( [ this ]() { this->run(); } ); } @@ -631,10 +604,6 @@ public: } }; -void MdxArticleRequestRunnable::run() -{ - r.run(); -} void MdxArticleRequest::run() { @@ -754,33 +723,8 @@ sptr MdxDictionary::getArticle( const wstring & word, c } /// MdxDictionary::getResource - -class MddResourceRequest; - -class MddResourceRequestRunnable: public QRunnable -{ - MddResourceRequest & r; - QSemaphore & hasExited; - -public: - - MddResourceRequestRunnable( MddResourceRequest & r_, - QSemaphore & hasExited_ ): r( r_ ), - hasExited( hasExited_ ) - {} - - ~MddResourceRequestRunnable() - { - hasExited.release(); - } - - virtual void run(); -}; - class MddResourceRequest: public Dictionary::DataRequest { - friend class MddResourceRequestRunnable; - MdxDictionary & dict; wstring resourceName; QAtomicInt isCancelled; @@ -793,11 +737,10 @@ public: dict( dict_ ), resourceName( Utf8::decode( resourceName_ ) ) { - //QThreadPool::globalInstance()->start( new MddResourceRequestRunnable( *this, hasExited ) ); QThreadPool::globalInstance()->start( [ this ]() { this->run(); } ); } - void run(); // Run from another thread by MddResourceRequestRunnable + void run(); virtual void cancel() { @@ -811,11 +754,6 @@ public: } }; -void MddResourceRequestRunnable::run() -{ - r.run(); -} - void MddResourceRequest::run() { if ( Utils::AtomicInt::loadAcquire( isCancelled ) )