diff options
author | Tobias Madl <tobias.madl.dev@gmail.com> | 2014-12-19 13:01:46 +0000 |
---|---|---|
committer | Tobias Madl <tobias.madl.dev@gmail.com> | 2015-03-06 12:27:04 +0000 |
commit | 9e678c14e4fc8e58b1e0530744f648fa3958d338 (patch) | |
tree | 53ccb6244cff1b2ee39bc4d7605f103108fa45bc | |
parent | 1028643bc7d294e4c32b4ccea288d90088abae53 (diff) |
Timer: Reversed some Idles to Timer
Change-Id: I213722cc98490430378014290cb09cca9e469bbb
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 4 | ||||
-rw-r--r-- | sc/inc/scmod.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 47 | ||||
-rw-r--r-- | sd/source/ui/framework/configuration/ConfigurationUpdater.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/framework/configuration/ConfigurationUpdater.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx | 18 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/cache/SlsQueueProcessor.hxx | 2 | ||||
-rw-r--r-- | svtools/source/graphic/grfcache.cxx | 6 | ||||
-rw-r--r-- | svtools/source/graphic/grfcache.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentTimerManager.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentTimerManager.hxx | 2 |
14 files changed, 87 insertions, 52 deletions
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index ae2376b00265..64f9b83d470f 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -469,7 +469,7 @@ private: IdleFormattter aIdleFormatter; - Idle aOnlineSpellIdle; + Timer aOnlineSpellTimer; // If it is detected at one point that the StatusHdl has to be called, but // this should not happen immediately (critical section): @@ -983,8 +983,8 @@ public: inline EditEngine* GetEditEnginePtr() const { return pEditEngine; } - void StartOnlineSpellTimer() { aOnlineSpellIdle.Start(); } - void StopOnlineSpellTimer() { aOnlineSpellIdle.Stop(); } + void StartOnlineSpellTimer() { aOnlineSpellTimer.Start(); } + void StopOnlineSpellTimer() { aOnlineSpellTimer.Stop(); } const OUString& GetAutoCompleteText() const { return aAutoCompleteText; } void SetAutoCompleteText(const OUString& rStr, bool bUpdateTipWindow); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 3fd9a7000249..dd0ad4f5af57 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -148,8 +148,8 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : aIdleFormatter.SetPriority( VCL_IDLE_PRIORITY_REPAINT ); aIdleFormatter.SetIdleHdl( LINK( this, ImpEditEngine, IdleFormatHdl ) ); - aOnlineSpellIdle.SetPriority( VCL_IDLE_PRIORITY_LOW ); - aOnlineSpellIdle.SetIdleHdl( LINK( this, ImpEditEngine, OnlineSpellHdl ) ); + aOnlineSpellTimer.SetTimeout( 100 ); + aOnlineSpellTimer.SetTimeoutHdl( LINK( this, ImpEditEngine, OnlineSpellHdl ) ); // Access data already from here on! SetRefDevice( NULL ); @@ -163,7 +163,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : ImpEditEngine::~ImpEditEngine() { aStatusTimer.Stop(); - aOnlineSpellIdle.Stop(); + aOnlineSpellTimer.Stop(); aIdleFormatter.Stop(); // Destroying templates may otherwise cause unnecessary formatting, diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 6c3dd128a56f..70ca386ecfad 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -313,7 +313,7 @@ IMPL_LINK_NOARG(ImpEditEngine, OnlineSpellHdl) if ( !Application::AnyInput( VclInputFlags::KEYBOARD ) && GetUpdateMode() && IsFormatted() ) DoOnlineSpelling(); else - aOnlineSpellIdle.Start(); + aOnlineSpellTimer.Start(); return 0; } diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index de54276f0673..f0aa045ccea3 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1477,7 +1477,7 @@ EESpellState ImpEditEngine::Spell( EditView* pEditView, bool bMultipleDoc ) if ( !xSpeller.is() ) return EE_SPELL_NOSPELLER; - aOnlineSpellIdle.Stop(); + aOnlineSpellTimer.Stop(); // In MultipleDoc always from the front / rear ... if ( bMultipleDoc ) @@ -2442,7 +2442,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, bool bSpellAtC break; } if ( bRestartTimer ) - aOnlineSpellIdle.Start(); + aOnlineSpellTimer.Start(); } diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 7d23cc7657bd..2c513a96deca 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -81,7 +81,7 @@ class ScAnyRefModalDlg; class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener { - Idle aIdle; + Timer aIdleTimer; Idle aSpellIdle; ScDragData* mpDragData; ScClipData* mpClipData; diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index fd8d866353fa..5c63049fda2f 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -112,6 +112,13 @@ #include "formulagroup.hxx" #include <documentlinkmgr.hxx> +#define SC_IDLE_MIN 150 +#define SC_IDLE_MAX 3000 +#define SC_IDLE_STEP 75 +#define SC_IDLE_COUNT 50 + +static sal_uInt16 nIdleCount = 0; + SFX_IMPL_INTERFACE(ScModule, SfxShell) void ScModule::InitInterface_Impl() @@ -169,9 +176,9 @@ ScModule::ScModule( SfxObjectFactory* pFact ) : aSpellIdle.SetPriority(VCL_IDLE_PRIORITY_REPAINT); aSpellIdle.SetIdleHdl( LINK( this, ScModule, SpellTimerHdl ) ); - aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWER); - aIdle.SetIdleHdl( LINK( this, ScModule, IdleHandler ) ); - aIdle.Start(); + aIdleTimer.SetTimeout(SC_IDLE_MIN); + aIdleTimer.SetTimeoutHdl( LINK( this, ScModule, IdleHandler ) ); + aIdleTimer.Start(); pMessagePool = new ScMessagePool; pMessagePool->FreezeIdRanges(); @@ -1844,7 +1851,11 @@ void ScModule::EndReference() */ void ScModule::AnythingChanged() { - aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWER); + sal_uLong nOldTime = aIdleTimer.GetTimeout(); + if ( nOldTime != SC_IDLE_MIN ) + aIdleTimer.SetTimeout( SC_IDLE_MIN ); + + nIdleCount = 0; } static void lcl_CheckNeedsRepaint( ScDocShell* pDocShell ) @@ -1864,7 +1875,7 @@ IMPL_LINK_NOARG(ScModule, IdleHandler) { if ( Application::AnyInput( VCL_INPUT_MOUSEANDKEYBOARD ) ) { - aIdle.Start(); // Timeout unchanged + aIdleTimer.Start(); // Timeout unchanged return 0; } @@ -1905,12 +1916,30 @@ IMPL_LINK_NOARG(ScModule, IdleHandler) } } - if (bMore) - aIdle.SetPriority(VCL_IDLE_PRIORITY_LOW); + sal_uLong nOldTime = aIdleTimer.GetTimeout(); + sal_uLong nNewTime = nOldTime; + if ( bMore ) + { + nNewTime = SC_IDLE_MIN; + nIdleCount = 0; + } else - aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWEST); + { + // Set SC_IDLE_COUNT to initial Timeout - increase afterwards + if ( nIdleCount < SC_IDLE_COUNT ) + ++nIdleCount; + else + { + nNewTime += SC_IDLE_STEP; + if ( nNewTime > SC_IDLE_MAX ) + nNewTime = SC_IDLE_MAX; + } + } + if ( nNewTime != nOldTime ) + aIdleTimer.SetTimeout( nNewTime ); + - aIdle.Start(); + aIdleTimer.Start(); return 0; } diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index 42b2eb78b60e..10ea9201038f 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -36,7 +36,11 @@ using ::sd::framework::FrameworkHelper; using ::std::vector; namespace { +static const sal_Int32 snShortTimeout (100); +static const sal_Int32 snNormalTimeout (1000); +static const sal_Int32 snLongTimeout (10000); static const sal_Int32 snShortTimeoutCountThreshold (1); +static const sal_Int32 snNormalTimeoutCountThreshold (5); } namespace sd { namespace framework { @@ -66,21 +70,21 @@ ConfigurationUpdater::ConfigurationUpdater ( mbUpdatePending(false), mbUpdateBeingProcessed(false), mnLockCount(0), - maUpdateIdle(), + maUpdateTimer(), mnFailedUpdateCount(0), mpResourceManager(rpResourceManager) { // Prepare the timer that is started when after an update the current // and the requested configuration differ. With the timer we try // updates until the two configurations are the same. - maUpdateIdle.SetPriority(VCL_IDLE_PRIORITY_LOWEST); - maUpdateIdle.SetIdleHdl(LINK(this,ConfigurationUpdater,TimeoutHandler)); + maUpdateTimer.SetTimeout(snNormalTimeout); + maUpdateTimer.SetTimeoutHdl(LINK(this,ConfigurationUpdater,TimeoutHandler)); SetControllerManager(rxControllerManager); } ConfigurationUpdater::~ConfigurationUpdater (void) { - maUpdateIdle.Stop(); + maUpdateTimer.Stop(); } void ConfigurationUpdater::SetControllerManager( @@ -214,11 +218,13 @@ void ConfigurationUpdater::CheckUpdateSuccess (void) if ( ! AreConfigurationsEquivalent(mxCurrentConfiguration, mxRequestedConfiguration)) { if (mnFailedUpdateCount <= snShortTimeoutCountThreshold) - maUpdateIdle.SetPriority(VCL_IDLE_PRIORITY_LOW); + maUpdateTimer.SetTimeout(snShortTimeout); + else if (mnFailedUpdateCount < snNormalTimeoutCountThreshold) + maUpdateTimer.SetTimeout(snNormalTimeout); else - maUpdateIdle.SetPriority(VCL_IDLE_PRIORITY_LOWEST); + maUpdateTimer.SetTimeout(snLongTimeout); ++mnFailedUpdateCount; - maUpdateIdle.Start(); + maUpdateTimer.Start(); } else { diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx index 382fac6c97db..bde705ff32af 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.hxx @@ -131,7 +131,7 @@ private: This is used to overcome problems with resources that become available asynchronously. */ - Idle maUpdateIdle; + Timer maUpdateTimer; /** The number of failed updates (those after which the current configuration is not equivalent to the requested configuration) is diff --git a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx index 1364bee980e5..dcbdff7f6e3b 100644 --- a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx +++ b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx @@ -32,7 +32,7 @@ QueueProcessor::QueueProcessor ( const bool bDoSuperSampling, const SharedCacheContext& rpCacheContext) : maMutex(), - maIdle(), + maTimer(), mnTimeBetweenHighPriorityRequests (10/*ms*/), mnTimeBetweenLowPriorityRequests (100/*ms*/), mnTimeBetweenRequestsWhenNotIdle (1000/*ms*/), @@ -58,8 +58,8 @@ QueueProcessor::QueueProcessor ( if (aTimeBetweenReqeusts.has<sal_Int32>()) aTimeBetweenReqeusts >>= mnTimeBetweenRequestsWhenNotIdle; - maIdle.SetIdleHdl (LINK(this,QueueProcessor,ProcessRequestHdl)); - maIdle.SetPriority (VCL_IDLE_PRIORITY_REPAINT); + maTimer.SetTimeoutHdl (LINK(this,QueueProcessor,ProcessRequestHdl)); + maTimer.SetTimeout (10); } QueueProcessor::~QueueProcessor (void) @@ -70,20 +70,20 @@ void QueueProcessor::Start (int nPriorityClass) { if (mbIsPaused) return; - if ( ! maIdle.IsActive()) + if ( ! maTimer.IsActive()) { if (nPriorityClass == 0) - maIdle.SetPriority (VCL_IDLE_PRIORITY_REPAINT); + maTimer.SetTimeout (10); else - maIdle.SetPriority (VCL_IDLE_PRIORITY_LOW); - maIdle.Start(); + maTimer.SetTimeout (100); + maTimer.Start(); } } void QueueProcessor::Stop (void) { - if (maIdle.IsActive()) - maIdle.Stop(); + if (maTimer.IsActive()) + maTimer.Stop(); } void QueueProcessor::Pause (void) diff --git a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.hxx b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.hxx index 6993d5cdbf3c..df65ffaff5c8 100644 --- a/sd/source/ui/slidesorter/cache/SlsQueueProcessor.hxx +++ b/sd/source/ui/slidesorter/cache/SlsQueueProcessor.hxx @@ -92,7 +92,7 @@ private: */ ::osl::Mutex maMutex; - Idle maIdle; + Timer maTimer; DECL_LINK(ProcessRequestHdl, void *); sal_uInt32 mnTimeBetweenHighPriorityRequests; sal_uInt32 mnTimeBetweenLowPriorityRequests; diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index 485dfed7f5e4..d6d04fcc78c7 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -810,9 +810,9 @@ GraphicCache::GraphicCache( sal_uLong nDisplayCacheSize, sal_uLong nMaxObjDispla mnMaxObjDisplaySize ( nMaxObjDisplayCacheSize ), mnUsedDisplaySize ( 0UL ) { - maReleaseIdle.SetIdleHdl( LINK( this, GraphicCache, ReleaseTimeoutHdl ) ); - maReleaseIdle.SetPriority( VCL_IDLE_PRIORITY_LOWEST ); - maReleaseIdle.Start(); + maReleaseTimer.SetTimeoutHdl( LINK( this, GraphicCache, ReleaseTimeoutHdl ) ); + maReleaseTimer.SetTimeout( 10000 ); + maReleaseTimer.Start(); } GraphicCache::~GraphicCache() diff --git a/svtools/source/graphic/grfcache.hxx b/svtools/source/graphic/grfcache.hxx index 968c31290bbd..a1c990c08ea7 100644 --- a/svtools/source/graphic/grfcache.hxx +++ b/svtools/source/graphic/grfcache.hxx @@ -39,7 +39,7 @@ private: typedef std::list< GraphicCacheEntry* > GraphicCacheEntryList; typedef std::list< GraphicDisplayCacheEntry* > GraphicDisplayCacheEntryList; - Idle maReleaseIdle; + Timer maReleaseTimer; GraphicCacheEntryList maGraphicCache; GraphicDisplayCacheEntryList maDisplayCache; sal_uLong mnReleaseTimeoutSeconds; diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index b677ac77a558..aae31ff71866 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -41,44 +41,44 @@ DocumentTimerManager::DocumentTimerManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwdoc mbStartIdleTimer( false ), mIdleBlockCount( 0 ) { - maIdle.SetPriority( VCL_IDLE_PRIORITY_LOWEST ); - maIdle.SetIdleHdl( LINK( this, DocumentTimerManager, DoIdleJobs) ); + maIdleTimer.SetTimeout( 600 ); + maIdleTimer.SetTimeoutHdl( LINK( this, DocumentTimerManager, DoIdleJobs) ); } void DocumentTimerManager::StartIdling() { mbStartIdleTimer = true; if( !mIdleBlockCount ) - maIdle.Start(); + maIdleTimer.Start(); } void DocumentTimerManager::StopIdling() { mbStartIdleTimer = false; - maIdle.Stop(); + maIdleTimer.Stop(); } void DocumentTimerManager::BlockIdling() { - maIdle.Stop(); + maIdleTimer.Stop(); ++mIdleBlockCount; } void DocumentTimerManager::UnblockIdling() { --mIdleBlockCount; - if( !mIdleBlockCount && mbStartIdleTimer && !maIdle.IsActive() ) - maIdle.Start(); + if( !mIdleBlockCount && mbStartIdleTimer && !maIdleTimer.IsActive() ) + maIdleTimer.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 (!maIdleTimer.IsActive()) //fdo#73165 if the timer is already running don't restart from 0 + maIdleTimer.Start(); } -IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer *, pTimer ) +IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pTimer ) { #ifdef TIMELOG static ::rtl::Logfile* pModLogFile = 0; diff --git a/sw/source/core/inc/DocumentTimerManager.hxx b/sw/source/core/inc/DocumentTimerManager.hxx index 878c39b20751..42351cc42538 100644 --- a/sw/source/core/inc/DocumentTimerManager.hxx +++ b/sw/source/core/inc/DocumentTimerManager.hxx @@ -60,7 +60,7 @@ private: bool mbStartIdleTimer; //< idle timer mode start/stop sal_Int32 mIdleBlockCount; - Idle maIdle; + Timer maIdleTimer; }; } |