diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-01-19 12:18:52 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-01-20 10:32:04 +0000 |
commit | 7cf3ae68afb9d3f2f126e544de85f38a18ad3de0 (patch) | |
tree | 48d7e422e21f074095a6a17b1dd3e796ba45444e /include | |
parent | 8f29ee6c293a6d72b3cf0b6b735c90ba91fc5607 (diff) |
Apply stricter member access control for Tasks
This disallows changing mbAuto and changing values of
ImplSchedulerData outside of Scheduler / Task functions.
Change-Id: Ia624999bd63190c072eb66427aec38e7ac8cfa1b
Reviewed-on: https://gerrit.libreoffice.org/33317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/idle.hxx | 2 | ||||
-rw-r--r-- | include/vcl/scheduler.hxx | 9 | ||||
-rw-r--r-- | include/vcl/timer.hxx | 9 |
3 files changed, 14 insertions, 6 deletions
diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx index 85ea758096a9..8d79c2f92527 100644 --- a/include/vcl/idle.hxx +++ b/include/vcl/idle.hxx @@ -39,6 +39,8 @@ protected: virtual bool IsIdle() const override; virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow ) const override; + Idle( bool bAuto, const sal_Char *pDebugName = nullptr ); + public: Idle( const sal_Char *pDebugName = nullptr ); diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx index dbe312819e29..19fbb4f8d5cf 100644 --- a/include/vcl/scheduler.hxx +++ b/include/vcl/scheduler.hxx @@ -76,14 +76,16 @@ class VCL_DLLPUBLIC Task friend class Scheduler; friend struct ImplSchedulerData; -protected: ImplSchedulerData *mpSchedulerData; /// Pointer to the element in scheduler list const sal_Char *mpDebugName; /// Useful for debugging TaskPriority mePriority; /// Task priority bool mbActive; /// Currently in the scheduler +protected: static void StartTimer( sal_uInt64 nMS ); + inline const ImplSchedulerData* GetSchedulerData() const { return mpSchedulerData; } + virtual void SetDeletionFlags(); /// Is this item ready to be dispatched at nTimeNow virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const = 0; @@ -99,12 +101,13 @@ public: Task( const sal_Char *pDebugName ); Task( const Task& rTask ); virtual ~Task(); + Task& operator=( const Task& rTask ); void SetPriority(TaskPriority ePriority) { mePriority = ePriority; } TaskPriority GetPriority() const { return mePriority; } void SetDebugName( const sal_Char *pDebugName ) { mpDebugName = pDebugName; } - const char *GetDebugName() { return mpDebugName; } + const char *GetDebugName() const { return mpDebugName; } // Call handler virtual void Invoke() = 0; @@ -113,8 +116,6 @@ public: void Stop(); bool IsActive() const { return mbActive; } - - Task& operator=( const Task& rTask ); }; #endif // INCLUDED_VCL_SCHEDULER_HXX diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx index 07fb9a873259..e7d539fdabf4 100644 --- a/include/vcl/timer.hxx +++ b/include/vcl/timer.hxx @@ -25,18 +25,23 @@ class VCL_DLLPUBLIC Timer : public Task { -protected: Link<Timer *, void> maInvokeHandler; ///< Callback Link sal_uInt64 mnTimeout; - bool mbAuto; + const bool mbAuto; +protected: virtual void SetDeletionFlags() override; virtual bool ReadyForSchedule( bool bIdle, sal_uInt64 nTimeNow ) const override; virtual bool IsIdle() const override; virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow ) const override; + Timer( bool bAuto, const sal_Char *pDebugName = nullptr ); + public: Timer( const sal_Char *pDebugName = nullptr ); + Timer( const Timer& rTimer ); + virtual ~Timer() override; + Timer& operator=( const Timer& rTimer ); /** * Calls the maInvokeHandler with the parameter this. |