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 /sd | |
parent | 1028643bc7d294e4c32b4ccea288d90088abae53 (diff) |
Timer: Reversed some Idles to Timer
Change-Id: I213722cc98490430378014290cb09cca9e469bbb
Diffstat (limited to 'sd')
4 files changed, 24 insertions, 18 deletions
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; |