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
902748b6
Kaydet (Commit)
902748b6
authored
Eki 11, 2013
tarafından
Michael Meeks
Kaydeden (comit)
Matúš Kukan
Eki 17, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fastparser: re-work locking, add high & low watermarks, change sizes etc.
Change-Id: I7fe1435addc6dce5a74a8411f7825cea331a5b3f
üst
9612bdbf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
6 deletions
+37
-6
fastparser.cxx
sax/source/fastparser/fastparser.cxx
+32
-5
fastparser.hxx
sax/source/fastparser/fastparser.hxx
+5
-1
No files found.
sax/source/fastparser/fastparser.cxx
Dosyayı görüntüle @
902748b6
...
@@ -565,15 +565,23 @@ void FastSaxParser::parseStream( const InputSource& maStructSource) throw (SAXEx
...
@@ -565,15 +565,23 @@ void FastSaxParser::parseStream( const InputSource& maStructSource) throw (SAXEx
xParser
->
launch
();
xParser
->
launch
();
bool
done
=
false
;
bool
done
=
false
;
do
{
do
{
rEntity
.
maEventsPushed
.
wait
();
rEntity
.
maConsumeResume
.
wait
();
rEntity
.
maEventsPushed
.
reset
();
rEntity
.
maConsumeResume
.
reset
();
MutexGuard
aGuard
(
rEntity
.
maEventProtector
);
osl
::
ResettableMutexGuard
aGuard
(
rEntity
.
maEventProtector
);
while
(
!
rEntity
.
maPendingEvents
.
empty
())
while
(
!
rEntity
.
maPendingEvents
.
empty
())
{
{
if
(
rEntity
.
maPendingEvents
.
size
()
<=
rEntity
.
mnEventLowWater
)
rEntity
.
maProduceResume
.
set
();
// start producer again
EventList
*
pEventList
=
rEntity
.
maPendingEvents
.
front
();
EventList
*
pEventList
=
rEntity
.
maPendingEvents
.
front
();
rEntity
.
maPendingEvents
.
pop
();
rEntity
.
maPendingEvents
.
pop
();
aGuard
.
clear
();
// unlock
if
(
!
consume
(
pEventList
))
if
(
!
consume
(
pEventList
))
done
=
true
;
done
=
true
;
aGuard
.
reset
();
// lock
}
}
}
while
(
!
done
);
}
while
(
!
done
);
xParser
->
join
();
xParser
->
join
();
...
@@ -748,12 +756,18 @@ OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int3
...
@@ -748,12 +756,18 @@ OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int3
void
FastSaxParser
::
deleteUsedEvents
()
void
FastSaxParser
::
deleteUsedEvents
()
{
{
Entity
&
rEntity
=
getEntity
();
Entity
&
rEntity
=
getEntity
();
osl
::
ResettableMutexGuard
aGuard
(
rEntity
.
maEventProtector
);
while
(
!
rEntity
.
maUsedEvents
.
empty
())
while
(
!
rEntity
.
maUsedEvents
.
empty
())
{
{
EventList
*
pEventList
=
rEntity
.
maUsedEvents
.
front
();
EventList
*
pEventList
=
rEntity
.
maUsedEvents
.
front
();
rEntity
.
maUsedEvents
.
pop
();
rEntity
.
maUsedEvents
.
pop
();
aGuard
.
clear
();
// unlock
delete
pEventList
;
delete
pEventList
;
aGuard
.
reset
();
// lock
}
}
}
}
...
@@ -770,11 +784,24 @@ void FastSaxParser::produce(const Event& aEvent)
...
@@ -770,11 +784,24 @@ void FastSaxParser::produce(const Event& aEvent)
aEvent
->
maType
==
CallbackType
::
EXCEPTION
||
aEvent
->
maType
==
CallbackType
::
EXCEPTION
||
rEntity
.
mpProducedEvents
->
size
()
==
rEntity
.
mnEventListSize
)
rEntity
.
mpProducedEvents
->
size
()
==
rEntity
.
mnEventListSize
)
{
{
MutexGuard
aGuard
(
rEntity
.
maEventProtector
);
osl
::
ResettableMutexGuard
aGuard
(
rEntity
.
maEventProtector
);
while
(
rEntity
.
maPendingEvents
.
size
()
>=
rEntity
.
mnEventHighWater
)
{
// pause parsing for a bit
aGuard
.
clear
();
// unlock
rEntity
.
maProduceResume
.
wait
();
rEntity
.
maProduceResume
.
reset
();
aGuard
.
reset
();
// lock
}
rEntity
.
maPendingEvents
.
push
(
rEntity
.
mpProducedEvents
);
rEntity
.
maPendingEvents
.
push
(
rEntity
.
mpProducedEvents
);
rEntity
.
mpProducedEvents
=
0
;
rEntity
.
mpProducedEvents
=
0
;
aGuard
.
clear
();
// unlock
rEntity
.
maConsumeResume
.
set
();
deleteUsedEvents
();
deleteUsedEvents
();
rEntity
.
maEventsPushed
.
set
();
}
}
}
}
...
...
sax/source/fastparser/fastparser.hxx
Dosyayı görüntüle @
902748b6
...
@@ -118,7 +118,11 @@ struct Entity : public ParserData
...
@@ -118,7 +118,11 @@ struct Entity : public ParserData
std
::
queue
<
EventList
*
>
maPendingEvents
;
std
::
queue
<
EventList
*
>
maPendingEvents
;
std
::
queue
<
EventList
*
>
maUsedEvents
;
std
::
queue
<
EventList
*
>
maUsedEvents
;
osl
::
Mutex
maEventProtector
;
osl
::
Mutex
maEventProtector
;
osl
::
Condition
maEventsPushed
;
static
const
size_t
mnEventLowWater
=
4
;
static
const
size_t
mnEventHighWater
=
8
;
osl
::
Condition
maConsumeResume
;
osl
::
Condition
maProduceResume
;
// copied in copy constructor:
// copied in copy constructor:
...
...
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