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
422a41ff
Kaydet (Commit)
422a41ff
authored
Eyl 19, 2012
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sot: remove horrible hiding of LRU cache map
Change-Id: Ic8df1012752e78d3326999a07dc15a99e982b896
üst
3b3d738c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
36 deletions
+15
-36
stgcache.cxx
sot/source/sdstor/stgcache.cxx
+5
-34
stgcache.hxx
sot/source/sdstor/stgcache.hxx
+10
-2
No files found.
sot/source/sdstor/stgcache.cxx
Dosyayı görüntüle @
422a41ff
...
@@ -18,14 +18,6 @@
...
@@ -18,14 +18,6 @@
*/
*/
#if defined(_MSC_VER) && (_MSC_VER<1200)
#include <tools/presys.h>
#endif
#include <boost/unordered_map.hpp>
#if defined(_MSC_VER) && (_MSC_VER<1200)
#include <tools/postsys.h>
#endif
#include <string.h>
#include <string.h>
#include <osl/endian.h>
#include <osl/endian.h>
#include <tools/string.hxx>
#include <tools/string.hxx>
...
@@ -37,19 +29,6 @@
...
@@ -37,19 +29,6 @@
#include "stgdir.hxx"
#include "stgdir.hxx"
#include "stgio.hxx"
#include "stgio.hxx"
/*************************************************************************/
//-----------------------------------------------------------------------------
typedef
boost
::
unordered_map
<
sal_Int32
,
StgPage
*
,
boost
::
hash
<
sal_Int32
>
,
std
::
equal_to
<
sal_Int32
>
>
UsrStgPagePtr_Impl
;
#ifdef _MSC_VER
#pragma warning( disable: 4786 )
#endif
//#define CHECK_DIRTY 1
//#define CHECK_DIRTY 1
//#define READ_AFTER_WRITE 1
//#define READ_AFTER_WRITE 1
...
@@ -110,7 +89,6 @@ StgCache::StgCache()
...
@@ -110,7 +89,6 @@ StgCache::StgCache()
nError
=
SVSTREAM_OK
;
nError
=
SVSTREAM_OK
;
bMyStream
=
sal_False
;
bMyStream
=
sal_False
;
bFile
=
sal_False
;
bFile
=
sal_False
;
pLRUCache
=
NULL
;
pStorageStream
=
NULL
;
pStorageStream
=
NULL
;
}
}
...
@@ -118,7 +96,6 @@ StgCache::~StgCache()
...
@@ -118,7 +96,6 @@ StgCache::~StgCache()
{
{
Clear
();
Clear
();
SetStrm
(
NULL
,
sal_False
);
SetStrm
(
NULL
,
sal_False
);
delete
(
UsrStgPagePtr_Impl
*
)
pLRUCache
;
}
}
void
StgCache
::
SetPhysPageSize
(
short
n
)
void
StgCache
::
SetPhysPageSize
(
short
n
)
...
@@ -154,9 +131,7 @@ StgPage* StgCache::Create( sal_Int32 nPg )
...
@@ -154,9 +131,7 @@ StgPage* StgCache::Create( sal_Int32 nPg )
}
}
else
else
pElem
->
pNext1
=
pElem
->
pLast1
=
pElem
;
pElem
->
pNext1
=
pElem
->
pLast1
=
pElem
;
if
(
!
pLRUCache
)
maLRUCache
[
pElem
->
nPage
]
=
pElem
;
pLRUCache
=
new
UsrStgPagePtr_Impl
();
(
*
(
UsrStgPagePtr_Impl
*
)
pLRUCache
)[
pElem
->
nPage
]
=
pElem
;
pCur
=
pElem
;
pCur
=
pElem
;
// insert to Sorted
// insert to Sorted
...
@@ -194,8 +169,7 @@ void StgCache::Erase( StgPage* pElem )
...
@@ -194,8 +169,7 @@ void StgCache::Erase( StgPage* pElem )
pElem
->
pLast1
->
pNext1
=
pElem
->
pNext1
;
pElem
->
pLast1
->
pNext1
=
pElem
->
pNext1
;
if
(
pCur
==
pElem
)
if
(
pCur
==
pElem
)
pCur
=
(
pElem
->
pNext1
==
pElem
)
?
NULL
:
pElem
->
pNext1
;
pCur
=
(
pElem
->
pNext1
==
pElem
)
?
NULL
:
pElem
->
pNext1
;
if
(
pLRUCache
)
maLRUCache
.
erase
(
pElem
->
nPage
);
((
UsrStgPagePtr_Impl
*
)
pLRUCache
)
->
erase
(
pElem
->
nPage
);
// remove from Sorted
// remove from Sorted
pElem
->
pNext2
->
pLast2
=
pElem
->
pLast2
;
pElem
->
pNext2
->
pLast2
=
pElem
->
pLast2
;
pElem
->
pLast2
->
pNext2
=
pElem
->
pNext2
;
pElem
->
pLast2
->
pNext2
=
pElem
->
pNext2
;
...
@@ -219,18 +193,15 @@ void StgCache::Clear()
...
@@ -219,18 +193,15 @@ void StgCache::Clear()
while
(
pCur
!=
pElem
);
while
(
pCur
!=
pElem
);
pCur
=
NULL
;
pCur
=
NULL
;
pElem1
=
NULL
;
pElem1
=
NULL
;
delete
(
UsrStgPagePtr_Impl
*
)
pLRUCache
;
maLRUCache
.
clear
();
pLRUCache
=
NULL
;
}
}
// Look for a cached page
// Look for a cached page
StgPage
*
StgCache
::
Find
(
sal_Int32
nPage
)
StgPage
*
StgCache
::
Find
(
sal_Int32
nPage
)
{
{
if
(
!
pLRUCache
)
IndexToStgPage
::
iterator
aIt
=
maLRUCache
.
find
(
nPage
);
return
NULL
;
if
(
aIt
!=
maLRUCache
.
end
()
)
UsrStgPagePtr_Impl
::
iterator
aIt
=
((
UsrStgPagePtr_Impl
*
)
pLRUCache
)
->
find
(
nPage
);
if
(
aIt
!=
((
UsrStgPagePtr_Impl
*
)
pLRUCache
)
->
end
()
)
{
{
// page found
// page found
StgPage
*
pFound
=
(
*
aIt
).
second
;
StgPage
*
pFound
=
(
*
aIt
).
second
;
...
...
sot/source/sdstor/stgcache.hxx
Dosyayı görüntüle @
422a41ff
...
@@ -24,20 +24,28 @@
...
@@ -24,20 +24,28 @@
#include <tools/solar.h>
#include <tools/solar.h>
#include <tools/stream.hxx>
#include <tools/stream.hxx>
#include <stgelem.hxx>
#include <stgelem.hxx>
#include <boost/unordered_map.hpp>
class
UCBStorageStream
;
class
UCBStorageStream
;
class
StgPage
;
class
StgPage
;
class
StgDirEntry
;
class
StgDirEntry
;
class
StorageBase
;
class
StorageBase
;
typedef
boost
::
unordered_map
<
sal_Int32
,
StgPage
*
,
boost
::
hash
<
sal_Int32
>
,
std
::
equal_to
<
sal_Int32
>
>
IndexToStgPage
;
class
StgCache
{
class
StgCache
{
StgPage
*
pCur
;
// top of LRU list
StgPage
*
pCur
;
// top of LRU list
StgPage
*
pElem1
;
// top of ordered list
StgPage
*
pElem1
;
// top of ordered list
sal_uLong
nError
;
// error code
sal_uLong
nError
;
// error code
sal_Int32
nPages
;
// size of data area in pages
sal_Int32
nPages
;
// size of data area in pages
sal_uInt16
nRef
;
// reference count
sal_uInt16
nRef
;
// reference count
void
*
pLRUCache
;
// hash table of cached object
s
IndexToStgPage
maLRUCache
;
// hash of index to cached page
s
short
nPageSize
;
// page size of the file
short
nPageSize
;
// page size of the file
UCBStorageStream
*
pStorageStream
;
// holds reference to UCB storage stream
UCBStorageStream
*
pStorageStream
;
// holds reference to UCB storage stream
...
...
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