[Libreoffice-commits] core.git: Branch 'feature/priorities' - include/vcl vcl/source

Tobias Madl tobias.madl.dev at gmail.com
Mon Jan 19 08:31:07 PST 2015


 include/vcl/idle.hxx    |   13 ++++++-------
 vcl/source/app/idle.cxx |   11 ++++++++---
 2 files changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 7d40d5fbf0464725f85b24c1dcbe568b3a162c35
Author: Tobias Madl <tobias.madl.dev at gmail.com>
Date:   Mon Jan 19 16:30:23 2015 +0000

    Added Comments
    
    Change-Id: I093b4812bf3b75d6a6f3c8ea38755619f5c9d151

diff --git a/include/vcl/idle.hxx b/include/vcl/idle.hxx
index da0a5c7..5a46462 100644
--- a/include/vcl/idle.hxx
+++ b/include/vcl/idle.hxx
@@ -27,6 +27,7 @@
 struct ImplIdleData;
 struct ImplSVData;
 
+// The timemarks behind the priorities is the catgorizing of timer to idle
 enum class IdlePriority {
     VCL_IDLE_PRIORITY_STARVATIONPROTECTION  = -1, // Do not use this for normal prioritizing
     VCL_IDLE_PRIORITY_HIGHEST               = 0, // -> 0ms
@@ -41,16 +42,14 @@ enum class IdlePriority {
 };
 
 
-// To port from Timer -> Idle switch class name,
-// s/Timeout/DoIdle/ etc. and select priority
 class VCL_DLLPUBLIC Idle
 {
 protected:
-    ImplIdleData*   mpIdleData;
-    IdlePriority    mePriority;
-    IdlePriority    meDefaultPriority;
-    bool            mbActive;
-    Link            maIdleHdl;
+    ImplIdleData*   mpIdleData;         // Pointer to element in idle list
+    IdlePriority    mePriority;         // Idle priority ( maybe divergent to default)
+    IdlePriority    meDefaultPriority;  // Default idle priority
+    bool            mbActive;           // Currently in the scheduler
+    Link            maIdleHdl;          // Callback Link
 
     friend struct ImplIdleData;
 
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx
index c3e24e1..6ad03d2 100644
--- a/vcl/source/app/idle.cxx
+++ b/vcl/source/app/idle.cxx
@@ -59,7 +59,7 @@ struct ImplIdleData
                 pMostUrgent = p;
             else
             {
-                // Find the highest priority one somehow.
+                // Find the highest priority.
                 if ( p->mpIdle->GetPriority() < pMostUrgent->mpIdle->GetPriority() )
                 {
                     IncreasePriority(pMostUrgent->mpIdle);
@@ -77,8 +77,10 @@ struct ImplIdleData
     {
         switch(pIdle->GetPriority())
         {
+            // Increase priority based on their current priority
             case IdlePriority::VCL_IDLE_PRIORITY_STARVATIONPROTECTION:
                 break;
+            // If already highest priority -> extra state for starving tasks
             case IdlePriority::VCL_IDLE_PRIORITY_HIGHEST:
                 pIdle->SetPriority(IdlePriority::VCL_IDLE_PRIORITY_STARVATIONPROTECTION);
                 break;
@@ -142,7 +144,7 @@ void Idle::ProcessAllIdleHandlers()
     pIdleData = pSVData->mpFirstIdleData;
     while ( pIdleData )
     {
-        // Was timer destroyed in the meantime?
+        // Was Idle destroyed in the meantime?
         if ( pIdleData->mbDelete )
         {
             if ( pPrevIdleData )
@@ -166,6 +168,8 @@ void Idle::ProcessAllIdleHandlers()
 void Idle::SetPriority( IdlePriority ePriority )
 {
     mePriority = ePriority;
+    // Was a new priority set before excecution?
+    // Then take it as default priority
     if( !mbActive && meDefaultPriority == IdlePriority::VCL_IDLE_PRIORITY_DEFAULT )
         meDefaultPriority = mePriority;
 }
@@ -177,12 +181,13 @@ void Idle::DoIdle()
 
 void Idle::Start()
 {
+    // Mark timer active
     mbActive = true;
 
     ImplSVData* pSVData = ImplGetSVData();
     if ( !mpIdleData )
     {
-        // insert timer and start
+        // insert Idle
         mpIdleData = new ImplIdleData;
         mpIdleData->mpIdle        = this;
         mpIdleData->mbInIdle    = false;


More information about the Libreoffice-commits mailing list