From 9e678c14e4fc8e58b1e0530744f648fa3958d338 Mon Sep 17 00:00:00 2001 From: Tobias Madl Date: Fri, 19 Dec 2014 13:01:46 +0000 Subject: Timer: Reversed some Idles to Timer Change-Id: I213722cc98490430378014290cb09cca9e469bbb --- .../framework/configuration/ConfigurationUpdater.cxx | 20 +++++++++++++------- .../framework/configuration/ConfigurationUpdater.hxx | 2 +- sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx | 18 +++++++++--------- sd/source/ui/slidesorter/cache/SlsQueueProcessor.hxx | 2 +- 4 files changed, 24 insertions(+), 18 deletions(-) (limited to 'sd') 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()) 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; -- cgit