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
b5764eb9
Kaydet (Commit)
b5764eb9
authored
Şub 23, 2012
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adapted FileViewContentEnumerator to safer-to-use salhelper::Thread
üst
2eaa1422
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
53 deletions
+15
-53
contentenumeration.cxx
svtools/source/contnr/contentenumeration.cxx
+8
-36
contentenumeration.hxx
svtools/source/contnr/contentenumeration.hxx
+3
-13
fileview.cxx
svtools/source/contnr/fileview.cxx
+4
-4
No files found.
svtools/source/contnr/contentenumeration.cxx
Dosyayı görüntüle @
b5764eb9
...
@@ -94,7 +94,8 @@ namespace svt
...
@@ -94,7 +94,8 @@ namespace svt
const
Reference
<
XCommandEnvironment
>&
_rxCommandEnv
,
const
Reference
<
XCommandEnvironment
>&
_rxCommandEnv
,
ContentData
&
_rContentToFill
,
::
osl
::
Mutex
&
_rContentMutex
,
ContentData
&
_rContentToFill
,
::
osl
::
Mutex
&
_rContentMutex
,
const
IContentTitleTranslation
*
_pTranslator
)
const
IContentTitleTranslation
*
_pTranslator
)
:
m_rContent
(
_rContentToFill
)
:
Thread
(
"FileViewContentEnumerator"
)
,
m_rContent
(
_rContentToFill
)
,
m_rContentMutex
(
_rContentMutex
)
,
m_rContentMutex
(
_rContentMutex
)
,
m_refCount
(
0
)
,
m_refCount
(
0
)
,
m_xCommandEnv
(
_rxCommandEnv
)
,
m_xCommandEnv
(
_rxCommandEnv
)
...
@@ -142,15 +143,6 @@ namespace svt
...
@@ -142,15 +143,6 @@ namespace svt
void
FileViewContentEnumerator
::
enumerateFolderContent
(
void
FileViewContentEnumerator
::
enumerateFolderContent
(
const
FolderDescriptor
&
_rFolder
,
const
IUrlFilter
*
_pFilter
,
IEnumerationResultHandler
*
_pResultHandler
)
const
FolderDescriptor
&
_rFolder
,
const
IUrlFilter
*
_pFilter
,
IEnumerationResultHandler
*
_pResultHandler
)
{
{
// ensure that we don't get deleted while herein
acquire
();
// the matching "release" will be called in onTerminated
// Note that onTerminated is only called if run was left normally.
// If somebody terminates the thread from the outside, then onTerminated
// will never be called. However, our terminate method is not accessible
// to our clients, so the only class which could misbehave is this class
// here itself ...
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
::
osl
::
MutexGuard
aGuard
(
m_aMutex
);
m_aFolder
=
_rFolder
;
m_aFolder
=
_rFolder
;
m_pFilter
=
_pFilter
;
m_pFilter
=
_pFilter
;
...
@@ -159,25 +151,11 @@ namespace svt
...
@@ -159,25 +151,11 @@ namespace svt
OSL_ENSURE
(
m_aFolder
.
aContent
.
get
().
is
()
||
m_aFolder
.
sURL
.
Len
(),
OSL_ENSURE
(
m_aFolder
.
aContent
.
get
().
is
()
||
m_aFolder
.
sURL
.
Len
(),
"FileViewContentEnumerator::enumerateFolderContent: invalid folder descriptor!"
);
"FileViewContentEnumerator::enumerateFolderContent: invalid folder descriptor!"
);
// start the thread
launch
();
create
();
//TODO: a protocol is missing how to join with the launched thread
}
// before exit(3), to ensure the thread is no longer relying on any
// infrastructure while that infrastructure is being shut down in
//--------------------------------------------------------------------
// atexit handlers
oslInterlockedCount
SAL_CALL
FileViewContentEnumerator
::
acquire
()
{
return
osl_incrementInterlockedCount
(
&
m_refCount
);
}
//--------------------------------------------------------------------
oslInterlockedCount
SAL_CALL
FileViewContentEnumerator
::
release
()
{
if
(
0
==
osl_decrementInterlockedCount
(
&
m_refCount
)
)
{
delete
this
;
return
0
;
}
return
m_refCount
;
}
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
...
@@ -446,17 +424,11 @@ namespace svt
...
@@ -446,17 +424,11 @@ namespace svt
}
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
void
SAL_CALL
FileViewContentEnumerator
::
run
()
void
FileViewContentEnumerator
::
execute
()
{
{
enumerateFolderContent
();
enumerateFolderContent
();
}
}
//--------------------------------------------------------------------
void
SAL_CALL
FileViewContentEnumerator
::
onTerminated
()
{
release
();
}
//........................................................................
//........................................................................
}
// namespace svt
}
// namespace svt
//........................................................................
//........................................................................
...
...
svtools/source/contnr/contentenumeration.hxx
Dosyayı görüntüle @
b5764eb9
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
#include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
/** === end UNO includes === **/
/** === end UNO includes === **/
#include <
osl
/thread.hxx>
#include <
salhelper
/thread.hxx>
#include <rtl/ref.hxx>
#include <rtl/ref.hxx>
#include <ucbhelper/content.hxx>
#include <ucbhelper/content.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustring.hxx>
...
@@ -185,9 +185,7 @@ namespace svt
...
@@ -185,9 +185,7 @@ namespace svt
//====================================================================
//====================================================================
//= FileViewContentEnumerator
//= FileViewContentEnumerator
//====================================================================
//====================================================================
class
FileViewContentEnumerator
class
FileViewContentEnumerator
:
public
salhelper
::
Thread
:
public
::
rtl
::
IReference
,
private
::
osl
::
Thread
{
{
public
:
public
:
typedef
::
std
::
vector
<
SortingData_Impl
*
>
ContentData
;
typedef
::
std
::
vector
<
SortingData_Impl
*
>
ContentData
;
...
@@ -261,13 +259,6 @@ namespace svt
...
@@ -261,13 +259,6 @@ namespace svt
*/
*/
void
cancel
();
void
cancel
();
// IReference overridables
virtual
oslInterlockedCount
SAL_CALL
acquire
();
virtual
oslInterlockedCount
SAL_CALL
release
();
using
Thread
::
operator
new
;
using
Thread
::
operator
delete
;
protected
:
protected
:
~
FileViewContentEnumerator
();
~
FileViewContentEnumerator
();
...
@@ -275,8 +266,7 @@ namespace svt
...
@@ -275,8 +266,7 @@ namespace svt
EnumerationResult
enumerateFolderContent
();
EnumerationResult
enumerateFolderContent
();
// Thread overridables
// Thread overridables
virtual
void
SAL_CALL
run
();
virtual
void
execute
();
virtual
void
SAL_CALL
onTerminated
();
private
:
private
:
sal_Bool
implGetDocTitle
(
const
::
rtl
::
OUString
&
_rTargetURL
,
::
rtl
::
OUString
&
_rRet
)
const
;
sal_Bool
implGetDocTitle
(
const
::
rtl
::
OUString
&
_rTargetURL
,
::
rtl
::
OUString
&
_rRet
)
const
;
...
...
svtools/source/contnr/fileview.cxx
Dosyayı görüntüle @
b5764eb9
...
@@ -1865,10 +1865,10 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl(
...
@@ -1865,10 +1865,10 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl(
if
(
::
svt
::
SUCCESS
==
eResult
)
if
(
::
svt
::
SUCCESS
==
eResult
)
{
{
implEnumerationSuccess
();
implEnumerationSuccess
();
m_pContentEnumerator
=
NULL
;
m_pContentEnumerator
.
clear
()
;
return
eSuccess
;
return
eSuccess
;
}
}
m_pContentEnumerator
=
NULL
;
m_pContentEnumerator
.
clear
()
;
return
eFailure
;
return
eFailure
;
}
}
...
@@ -2126,7 +2126,7 @@ void SvtFileView_Impl::CancelRunningAsyncAction()
...
@@ -2126,7 +2126,7 @@ void SvtFileView_Impl::CancelRunningAsyncAction()
m_pContentEnumerator
->
cancel
();
m_pContentEnumerator
->
cancel
();
m_bRunningAsyncAction
=
false
;
m_bRunningAsyncAction
=
false
;
m_pContentEnumerator
=
NULL
;
m_pContentEnumerator
.
clear
()
;
if
(
m_pCancelAsyncTimer
.
is
()
&&
m_pCancelAsyncTimer
->
isTicking
()
)
if
(
m_pCancelAsyncTimer
.
is
()
&&
m_pCancelAsyncTimer
->
isTicking
()
)
m_pCancelAsyncTimer
->
stop
();
m_pCancelAsyncTimer
->
stop
();
m_pCancelAsyncTimer
=
NULL
;
m_pCancelAsyncTimer
=
NULL
;
...
@@ -2156,7 +2156,7 @@ void SvtFileView_Impl::enumerationDone( ::svt::EnumerationResult _eResult )
...
@@ -2156,7 +2156,7 @@ void SvtFileView_Impl::enumerationDone( ::svt::EnumerationResult _eResult )
SolarMutexGuard
aSolarGuard
;
SolarMutexGuard
aSolarGuard
;
::
osl
::
MutexGuard
aGuard
(
maMutex
);
::
osl
::
MutexGuard
aGuard
(
maMutex
);
m_pContentEnumerator
=
NULL
;
m_pContentEnumerator
.
clear
()
;
if
(
m_pCancelAsyncTimer
.
is
()
&&
m_pCancelAsyncTimer
->
isTicking
()
)
if
(
m_pCancelAsyncTimer
.
is
()
&&
m_pCancelAsyncTimer
->
isTicking
()
)
m_pCancelAsyncTimer
->
stop
();
m_pCancelAsyncTimer
->
stop
();
m_pCancelAsyncTimer
=
NULL
;
m_pCancelAsyncTimer
=
NULL
;
...
...
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