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
91dc9f3b
Kaydet (Commit)
91dc9f3b
authored
Agu 20, 2015
tarafından
Henry Castro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lok: load component library
Change-Id: I7fd048e9d3ccd1679bf4a3593be3efd61b5e3c3f
üst
2dd5ba7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
21 deletions
+117
-21
Library_sofficeapp.mk
desktop/Library_sofficeapp.mk
+1
-0
init.cxx
desktop/source/lib/init.cxx
+116
-21
No files found.
desktop/Library_sofficeapp.mk
Dosyayı görüntüle @
91dc9f3b
...
@@ -58,6 +58,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
...
@@ -58,6 +58,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
ucbhelper \
ucbhelper \
utl \
utl \
vcl \
vcl \
xmlreader \
$(gb_UWINAPI) \
$(gb_UWINAPI) \
))
))
...
...
desktop/source/lib/init.cxx
Dosyayı görüntüle @
91dc9f3b
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
#include <unotools/mediadescriptor.hxx>
#include <unotools/mediadescriptor.hxx>
#include <osl/module.hxx>
#include <osl/module.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/sequence.hxx>
#include <xmlreader/xmlreader.hxx>
#include <app.hxx>
#include <app.hxx>
...
@@ -966,31 +967,125 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit:
...
@@ -966,31 +967,125 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit:
}
}
}
}
static
void
loadSharedLibrary
(
const
OUString
&
aUriRdb
)
{
int
nsId
;
int
nUcNsId
;
OUString
sAttrUri
;
OUString
sAttrLoader
;
xmlreader
::
Span
aName
;
xmlreader
::
XmlReader
::
Result
aItem
=
xmlreader
::
XmlReader
::
RESULT_BEGIN
;
xmlreader
::
XmlReader
aRdbReader
(
aUriRdb
);
nUcNsId
=
aRdbReader
.
registerNamespaceIri
(
xmlreader
::
Span
(
RTL_CONSTASCII_STRINGPARAM
(
"http://openoffice.org/2010/uno-components"
)));
while
(
aItem
!=
xmlreader
::
XmlReader
::
RESULT_DONE
)
{
aItem
=
aRdbReader
.
nextItem
(
xmlreader
::
XmlReader
::
TEXT_NONE
,
&
aName
,
&
nsId
);
if
(
nsId
==
nUcNsId
&&
aName
.
equals
(
RTL_CONSTASCII_STRINGPARAM
(
"component"
)))
{
sAttrLoader
=
OUString
();
sAttrUri
=
OUString
();
while
(
aRdbReader
.
nextAttribute
(
&
nsId
,
&
aName
))
{
if
(
nsId
==
xmlreader
::
XmlReader
::
NAMESPACE_NONE
&&
aName
.
equals
(
RTL_CONSTASCII_STRINGPARAM
(
"loader"
)))
sAttrLoader
=
aRdbReader
.
getAttributeValue
(
false
).
convertFromUtf8
();
else
if
(
nsId
==
xmlreader
::
XmlReader
::
NAMESPACE_NONE
&&
aName
.
equals
(
RTL_CONSTASCII_STRINGPARAM
(
"uri"
)))
sAttrUri
=
aRdbReader
.
getAttributeValue
(
false
).
convertFromUtf8
();
}
try
{
sAttrUri
=
cppu
::
bootstrap_expandUri
(
sAttrUri
);
}
catch
(
css
::
lang
::
IllegalArgumentException
)
{
fprintf
(
stderr
,
"Cannot expand URI '%s'
\n
"
,
OUStringToOString
(
sAttrUri
,
RTL_TEXTENCODING_UTF8
).
getStr
());
}
if
(
sAttrLoader
==
"com.sun.star.loader.SharedLibrary"
)
{
oslModule
aModule
=
osl_loadModule
(
sAttrUri
.
pData
,
SAL_LOADMODULE_NOW
|
SAL_LOADMODULE_GLOBAL
);
SAL_INFO
(
"lok"
,
"loaded component library "
<<
sAttrUri
<<
(
aModule
?
" ok"
:
" no"
));
// leak aModule
// osl_unloadModule(aModule);
aModule
=
0
;
}
}
}
}
/// pre-load all C++ component factories and leak references to them.
/// pre-load all C++ component factories and leak references to them.
static
void
forceLoadAllNativeComponents
()
static
void
forceLoadAllNativeComponents
(
const
OUString
&
aAppURL
)
{
{
// FIXME: we need to inject RTLD_NOW into here, either by a
sal_Int32
nIndex
=
0
;
// putenv("LD_BIND_NOW=1") in parent process or ... (?).
try
{
rtl
::
Bootstrap
bs
(
aAppURL
+
"/"
+
SAL_CONFIGFILE
(
"uno"
));
uno
::
Reference
<
container
::
XContentEnumerationAccess
>
xEnumAcc
(
if
(
bs
.
getHandle
()
==
0
)
xContext
->
getServiceManager
(),
css
::
uno
::
UNO_QUERY_THROW
);
{
uno
::
Reference
<
container
::
XHierarchicalNameAccess
>
xTypeMgr
(
fprintf
(
stderr
,
"Cannot open uno ini '%s'
\n
"
,
xContext
->
getValueByName
(
OUStringToOString
(
aAppURL
+
"/"
+
SAL_CONFIGFILE
(
"uno"
),
RTL_TEXTENCODING_UTF8
).
getStr
());
"/singletons/com.sun.star.reflection.theTypeDescriptionManager"
),
return
;
css
::
uno
::
UNO_QUERY_THROW
);
}
uno
::
Sequence
<
OUString
>
aServiceNames
(
xContext
->
getServiceManager
()
->
getAvailableServiceNames
());
OUString
aRdbFiles
;
if
(
!
bs
.
getFrom
(
"UNO_SERVICES"
,
aRdbFiles
))
for
(
sal_Int32
i
=
0
;
i
!=
aServiceNames
.
getLength
();
++
i
)
{
fprintf
(
stderr
,
"Cannot obtain UNO_SERVICES from uno ini
\n
"
);
return
;
}
while
(
nIndex
!=
-
1
)
{
OUString
aUriRdb
(
aRdbFiles
.
getToken
(
0
,
' '
,
nIndex
));
if
(
aUriRdb
.
isEmpty
())
continue
;
if
(
aUriRdb
[
0
]
==
'?'
)
aUriRdb
=
aUriRdb
.
copy
(
1
);
if
(
aUriRdb
.
startsWith
(
"<"
)
&&
aUriRdb
.
endsWith
(
">*"
))
{
aUriRdb
=
aUriRdb
.
copy
(
1
,
aUriRdb
.
getLength
()
-
3
);
osl
::
Directory
aDir
(
aUriRdb
);
if
(
aDir
.
open
()
==
osl
::
FileBase
::
E_None
)
{
while
(
true
)
{
osl
::
DirectoryItem
aDirItem
;
if
(
aDir
.
getNextItem
(
aDirItem
,
SAL_MAX_UINT32
)
!=
osl
::
FileBase
::
E_None
)
break
;
osl
::
FileStatus
stat
(
osl_FileStatus_Mask_Type
|
osl_FileStatus_Mask_FileName
|
osl_FileStatus_Mask_FileURL
);
if
(
aDirItem
.
getFileStatus
(
stat
)
==
osl
::
FileBase
::
E_None
)
loadSharedLibrary
(
stat
.
getFileURL
());
}
}
else
{
fprintf
(
stderr
,
"Cannot open directory '%s'
\n
"
,
OUStringToOString
(
aUriRdb
,
RTL_TEXTENCODING_UTF8
).
getStr
());
}
}
else
{
{
css
::
uno
::
Reference
<
css
::
container
::
XEnumeration
>
xServiceImpls
(
loadSharedLibrary
(
aUriRdb
);
xEnumAcc
->
createContentEnumeration
(
aServiceNames
[
i
]),
css
::
uno
::
UNO_SET_THROW
);
SAL_INFO
(
"lok"
,
"service "
<<
aServiceNames
[
i
]);
// FIXME: need to actually load and link each native DSO.
}
}
}
catch
(
const
uno
::
Exception
&
)
{
}
}
}
}
...
@@ -1072,7 +1167,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
...
@@ -1072,7 +1167,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
if
(
eStage
==
PRE_INIT
)
if
(
eStage
==
PRE_INIT
)
{
{
forceLoadAllNativeComponents
();
forceLoadAllNativeComponents
(
aAppURL
);
forceLoadFilterXML
();
forceLoadFilterXML
();
}
}
...
...
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