Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
0e10b343
Kaydet (Commit)
0e10b343
authored
Ock 21, 2015
tarafından
Tobias Madl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Idle: New enum system, comments
Change-Id: I8ca272481e573bf3338c5c1b9873a39022928812
üst
b380220b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
67 deletions
+53
-67
idle.hxx
include/vcl/idle.hxx
+35
-16
idle.cxx
vcl/source/app/idle.cxx
+18
-51
No files found.
include/vcl/idle.hxx
Dosyayı görüntüle @
0e10b343
...
...
@@ -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
me
Priority
;
// Idle priority ( maybe divergent to default)
sal_Int32
mi
Priority
;
// 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
();
...
...
vcl/source/app/idle.cxx
Dosyayı görüntüle @
0e10b343
...
...
@@ -26,17 +26,17 @@
struct
ImplIdleData
{
ImplIdleData
*
mpNext
;
// Pointer to the next
Instance
ImplIdleData
*
mpNext
;
// Pointer to the next
element in list
Idle
*
mpIdle
;
// Pointer to VCL Idle instance
bool
mbDelete
;
//
Was Idle deleted during Update()
?
bool
mbInIdle
;
//
Are we in a idle handler
?
bool
mbDelete
;
//
Destroy this idle
?
bool
mbInIdle
;
//
Idle handler currently processed
?
void
Invoke
()
{
if
(
mbDelete
||
mbInIdle
)
return
;
mpIdle
->
Set
Priority
(
mpIdle
->
GetDefaultPriority
(
));
mpIdle
->
Set
SchedulingPriority
(
convertToInt
(
mpIdle
->
GetDefaultPriority
()
));
mbDelete
=
true
;
mpIdle
->
mbActive
=
false
;
...
...
@@ -65,49 +65,16 @@ struct ImplIdleData
// the current is the new most urgent. So starving is impossible.
if
(
p
->
mpIdle
->
GetPriority
()
<
pMostUrgent
->
mpIdle
->
GetPriority
()
)
{
IncreasePriority
(
pMostUrgent
->
mpIdle
);
pMostUrgent
->
mpIdle
->
SetSchedulingPriority
(
pMostUrgent
->
mpIdle
->
GetPriority
()
-
1
);
pMostUrgent
=
p
;
}
else
IncreasePriority
(
p
->
mpIdle
);
p
->
mpIdle
->
SetSchedulingPriority
(
p
->
mpIdle
->
GetPriority
()
-
1
);
}
}
return
pMostUrgent
;
}
static
void
IncreasePriority
(
Idle
*
pIdle
)
{
switch
(
pIdle
->
GetPriority
())
{
// Increase priority based on their current priority;
// (so don't use VCL_IDLE_PRIORITY_STARVATIONPROTECTION for default-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
;
case
IdlePriority
:
:
VCL_IDLE_PRIORITY_HIGH
:
pIdle
->
SetPriority
(
IdlePriority
::
VCL_IDLE_PRIORITY_HIGHEST
);
break
;
case
IdlePriority
:
:
VCL_IDLE_PRIORITY_REPAINT
:
pIdle
->
SetPriority
(
IdlePriority
::
VCL_IDLE_PRIORITY_HIGH
);
break
;
case
IdlePriority
:
:
VCL_IDLE_PRIORITY_MEDIUM
:
pIdle
->
SetPriority
(
IdlePriority
::
VCL_IDLE_PRIORITY_REPAINT
);
break
;
case
IdlePriority
:
:
VCL_IDLE_PRIORITY_LOW
:
pIdle
->
SetPriority
(
IdlePriority
::
VCL_IDLE_PRIORITY_MEDIUM
);
break
;
case
IdlePriority
:
:
VCL_IDLE_PRIORITY_LOWER
:
pIdle
->
SetPriority
(
IdlePriority
::
VCL_IDLE_PRIORITY_LOW
);
break
;
case
IdlePriority
:
:
VCL_IDLE_PRIORITY_LOWEST
:
pIdle
->
SetPriority
(
IdlePriority
::
VCL_IDLE_PRIORITY_LOWER
);
break
;
}
}
};
void
Idle
::
ImplDeInitIdle
()
...
...
@@ -149,7 +116,7 @@ void Idle::ProcessAllIdleHandlers()
pIdleData
=
pSVData
->
mpFirstIdleData
;
while
(
pIdleData
)
{
//
Was idle destroyed in the meantime
?
//
Should idle be released from scheduling
?
if
(
pIdleData
->
mbDelete
)
{
if
(
pPrevIdleData
)
...
...
@@ -172,11 +139,12 @@ 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
;
meDefaultPriority
=
ePriority
;
}
void
Idle
::
SetSchedulingPriority
(
sal_Int32
iPriority
)
{
miPriority
=
iPriority
;
}
void
Idle
::
DoIdle
()
...
...
@@ -228,7 +196,7 @@ Idle& Idle::operator=( const Idle& rIdle )
Stop
();
mbActive
=
false
;
m
ePriority
=
rIdle
.
me
Priority
;
m
iPriority
=
rIdle
.
mi
Priority
;
meDefaultPriority
=
rIdle
.
meDefaultPriority
;
maIdleHdl
=
rIdle
.
maIdleHdl
;
...
...
@@ -240,15 +208,15 @@ Idle& Idle::operator=( const Idle& rIdle )
Idle
::
Idle
()
:
mpIdleData
(
NULL
),
m
ePriority
(
IdlePriority
::
VCL_IDLE_PRIORITY_DEFAULT
),
meDefaultPriority
(
IdlePriority
::
VCL_IDLE_PRIORITY_
DEFAULT
),
m
iPriority
(
convertToInt
(
IdlePriority
::
VCL_IDLE_PRIORITY_HIGH
)
),
meDefaultPriority
(
IdlePriority
::
VCL_IDLE_PRIORITY_
HIGH
),
mbActive
(
false
)
{
}
Idle
::
Idle
(
const
Idle
&
rIdle
)
:
mpIdleData
(
NULL
),
m
ePriority
(
rIdle
.
me
Priority
),
m
iPriority
(
rIdle
.
mi
Priority
),
meDefaultPriority
(
rIdle
.
meDefaultPriority
),
mbActive
(
false
),
maIdleHdl
(
rIdle
.
maIdleHdl
)
...
...
@@ -265,4 +233,4 @@ Idle::~Idle()
mpIdleData
->
mpIdle
=
NULL
;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment