diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-09-14 18:17:18 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-07-13 12:10:29 +0200 |
commit | 799a590ad2c291c61084b3229a04cb51954666ca (patch) | |
tree | b710b5aa5f2e46481383ae3b2719fc9de97d6afa /sw | |
parent | 36f93104d58abbe55cc4d245f4c81436a2b1eba5 (diff) |
Don't poll busy documents via idle task
Creates a very busy idle-loop, for non-task work like mail merge.
Change-Id: If7be82e4675008f23e6f4f6be5c40df40a231a8b
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/DocumentTimerManager.cxx | 33 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentTimerManager.hxx | 5 |
2 files changed, 15 insertions, 23 deletions
diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index 83ce6fe2dce9..4a9855570bd6 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -40,44 +40,44 @@ namespace sw DocumentTimerManager::DocumentTimerManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc ), mbStartIdleTimer( false ), mIdleBlockCount( 0 ), - maIdle("DocumentTimerManagerIdleTimer") + maDocIdle( i_rSwdoc ) { - maIdle.SetPriority( TaskPriority::LOWEST ); - maIdle.SetInvokeHandler( LINK( this, DocumentTimerManager, DoIdleJobs) ); - maIdle.SetDebugName( "sw::DocumentTimerManager maIdle" ); + maDocIdle.SetPriority( TaskPriority::LOWEST ); + maDocIdle.SetInvokeHandler( LINK( this, DocumentTimerManager, DoIdleJobs) ); + maDocIdle.SetDebugName( "sw::DocumentTimerManager maDocIdle" ); } void DocumentTimerManager::StartIdling() { mbStartIdleTimer = true; if( !mIdleBlockCount ) - maIdle.Start(); + maDocIdle.Start(); } void DocumentTimerManager::StopIdling() { mbStartIdleTimer = false; - maIdle.Stop(); + maDocIdle.Stop(); } void DocumentTimerManager::BlockIdling() { - maIdle.Stop(); + maDocIdle.Stop(); ++mIdleBlockCount; } void DocumentTimerManager::UnblockIdling() { --mIdleBlockCount; - if( !mIdleBlockCount && mbStartIdleTimer && !maIdle.IsActive() ) - maIdle.Start(); + if( !mIdleBlockCount && mbStartIdleTimer && !maDocIdle.IsActive() ) + maDocIdle.Start(); } void DocumentTimerManager::StartBackgroundJobs() { // Trigger DoIdleJobs(), asynchronously. - if (!maIdle.IsActive()) //fdo#73165 if the timer is already running don't restart from 0 - maIdle.Start(); + if (!maDocIdle.IsActive()) //fdo#73165 if the timer is already running don't restart from 0 + maDocIdle.Start(); } IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void ) @@ -96,10 +96,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void ) for(SwViewShell& rSh : pShell->GetRingContainer()) { if( rSh.ActionPend() ) - { - pIdle->Start(); return; - } } if( pTmpRoot->IsNeedGrammarCheck() ) @@ -119,9 +116,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void ) if ((*pLayIter)->IsIdleFormat()) { (*pLayIter)->GetCurrShell()->LayoutIdle(); - // Defer the remaining work. - pIdle->Start(); return; } } @@ -135,11 +130,8 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void ) /* && !pStartSh->GetViewOptions()->IsFieldName()*/ ) { if ( m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().IsInUpdateFields() || - m_rDoc.getIDocumentFieldsAccess().IsExpFieldsLocked() ) - { - pIdle->Start(); + m_rDoc.getIDocumentFieldsAccess().IsExpFieldsLocked() ) return; - } // Action brackets! m_rDoc.getIDocumentFieldsAccess().GetUpdateFields().SetInUpdateFields( true ); @@ -167,6 +159,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void ) if( pModLogFile && 1 != (long)pModLogFile ) delete pModLogFile, static_cast<long&>(pModLogFile) = 1; #endif + pIdle->Stop(); } DocumentTimerManager::~DocumentTimerManager() {} diff --git a/sw/source/core/inc/DocumentTimerManager.hxx b/sw/source/core/inc/DocumentTimerManager.hxx index da4b9e4b30fd..698762ab087e 100644 --- a/sw/source/core/inc/DocumentTimerManager.hxx +++ b/sw/source/core/inc/DocumentTimerManager.hxx @@ -21,8 +21,8 @@ #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTTIMERMANAGER_HXX #include <IDocumentTimerAccess.hxx> +#include <SwDocIdle.hxx> -#include <vcl/idle.hxx> #include <sal/types.h> #include <tools/link.hxx> @@ -47,7 +47,6 @@ public: void StartBackgroundJobs() override; - // Our own 'IdleTimer' calls the following method DECL_LINK( DoIdleJobs, Timer *, void ); virtual ~DocumentTimerManager() override; @@ -61,7 +60,7 @@ private: bool mbStartIdleTimer; //< idle timer mode start/stop sal_Int32 mIdleBlockCount; - Idle maIdle; + SwDocIdle maDocIdle; }; } |