diff options
author | Tobias Madl <tobias.madl.dev@gmail.com> | 2015-01-21 14:04:59 +0100 |
---|---|---|
committer | Tobias Madl <tobias.madl.dev@gmail.com> | 2015-03-06 12:27:08 +0000 |
commit | 0e10b34342bd7b94b69f2eac8c9b1df89a2725f3 (patch) | |
tree | 42f9bace58a807cf98b3c11a33bdd7ac5820fc8b /include/vcl | |
parent | b380220bc1404ed5a9daa1a28f70696e84543f61 (diff) |
Idle: New enum system, comments
Change-Id: I8ca272481e573bf3338c5c1b9873a39022928812
Diffstat (limited to 'include/vcl')
-rw-r--r-- | include/vcl/idle.hxx | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx index 0415575a31b0..6c40ca3dbe89 100644 --- a/include/vcl/idle.hxx +++ b/include/vcl/idle.hxx @@ -27,28 +27,47 @@ struct ImplIdleData; struct ImplSVData; -// The timemarks behind the priorities are need to change timer to idle. It is to convert -// timeout values to priorities. enum class IdlePriority { - VCL_IDLE_PRIORITY_STARVATIONPROTECTION = -1, // Do not use this for normal prioritizing! - - VCL_IDLE_PRIORITY_HIGHEST = 0, // -> 0ms - VCL_IDLE_PRIORITY_HIGH = 1, // -> 1ms - VCL_IDLE_PRIORITY_DEFAULT = 1, // -> 1ms - VCL_IDLE_PRIORITY_REPAINT = 2, // -> 30ms - VCL_IDLE_PRIORITY_RESIZE = 3, // -> 50ms - VCL_IDLE_PRIORITY_MEDIUM = 3, // -> 50ms - VCL_IDLE_PRIORITY_LOW = 4, // -> 100ms - VCL_IDLE_PRIORITY_LOWER = 5, // -> 200ms - VCL_IDLE_PRIORITY_LOWEST = 6 // -> 400ms + VCL_IDLE_PRIORITY_HIGHEST, + VCL_IDLE_PRIORITY_HIGH, + VCL_IDLE_PRIORITY_REPAINT, + VCL_IDLE_PRIORITY_RESIZE, + VCL_IDLE_PRIORITY_MEDIUM, + VCL_IDLE_PRIORITY_LOW, + VCL_IDLE_PRIORITY_LOWER, + VCL_IDLE_PRIORITY_LOWEST }; +inline sal_Int32 convertToInt( IdlePriority ePriority ) +{ + switch (ePriority) + { + case IdlePriority::VCL_IDLE_PRIORITY_HIGHEST: + return 0; + case IdlePriority::VCL_IDLE_PRIORITY_HIGH: + return 1; + case IdlePriority::VCL_IDLE_PRIORITY_REPAINT: + return 2; + case IdlePriority::VCL_IDLE_PRIORITY_RESIZE: + return 3; + case IdlePriority::VCL_IDLE_PRIORITY_MEDIUM: + return 3; + case IdlePriority::VCL_IDLE_PRIORITY_LOW: + return 4; + case IdlePriority::VCL_IDLE_PRIORITY_LOWER: + return 5; + case IdlePriority::VCL_IDLE_PRIORITY_LOWEST: + return 6; + } + + return 42; // Should not happen +} class VCL_DLLPUBLIC Idle { protected: ImplIdleData* mpIdleData; // Pointer to element in idle list - IdlePriority mePriority; // Idle priority ( maybe divergent to default) + sal_Int32 miPriority; // Idle priority ( maybe divergent to default) IdlePriority meDefaultPriority; // Default idle priority bool mbActive; // Currently in the scheduler Link maIdleHdl; // Callback Link @@ -61,7 +80,8 @@ public: virtual ~Idle(); void SetPriority( IdlePriority ePriority ); - IdlePriority GetPriority() const { return mePriority; } + void SetSchedulingPriority( sal_Int32 iPriority ); + sal_Int32 GetPriority() const { return miPriority; } IdlePriority GetDefaultPriority() const { return meDefaultPriority; } /// Make it possible to associate a callback with this idle handler @@ -79,7 +99,6 @@ public: Idle& operator=( const Idle& rIdle ); static void ImplDeInitIdle(); - static void ImplIdleCallbackProc(); /// Process all pending idle tasks ahead of time in priority order. static void ProcessAllIdleHandlers(); |