Kaydet (Commit) 650d9d4b authored tarafından Jan Holesovsky's avatar Jan Holesovsky

Revert the pre-init work for now.

üst 7598ec2b
...@@ -43,18 +43,6 @@ rtl::OUString getBootstrapVariable( ...@@ -43,18 +43,6 @@ rtl::OUString getBootstrapVariable(
return v; return v;
} }
void default_preInitBootstrap(rtl::OUString const & aUri)
{
rtl::Bootstrap bsUri(aUri);
if (bsUri.getHandle() == 0)
throw css::uno::DeploymentException("Cannot open uno ini " + aUri);
// create the service manager
rtl::Reference< cppuhelper::ServiceManager > aManager(new cppuhelper::ServiceManager);
// read rdb files
aManager->init(getBootstrapVariable(bsUri, "UNO_SERVICES"));
aManager->loadImplementations();
}
} }
css::uno::Reference< css::uno::XComponentContext > css::uno::Reference< css::uno::XComponentContext >
...@@ -119,9 +107,4 @@ cppu::defaultBootstrap_InitialComponentContext() ...@@ -119,9 +107,4 @@ cppu::defaultBootstrap_InitialComponentContext()
return defaultBootstrap_InitialComponentContext(getUnoIniUri()); return defaultBootstrap_InitialComponentContext(getUnoIniUri());
} }
void
cppu::preInitBootstrap()
{
default_preInitBootstrap(getUnoIniUri());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -423,7 +423,6 @@ global: ...@@ -423,7 +423,6 @@ global:
# enableChangeListenerNotification # enableChangeListenerNotification
_ZN4cppu19OPropertySetHelper232enableChangeListenerNotificationEh; _ZN4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
_ZThn*_N4cppu19OPropertySetHelper232enableChangeListenerNotificationEh; _ZThn*_N4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
_ZN4cppu16preInitBootstrapEv;
} UDK_3.7; } UDK_3.7;
LIBO_UDK_3.9 { # LibO 3.7 LIBO_UDK_3.9 { # LibO 3.7
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
#include <sal/log.hxx> #include <sal/log.hxx>
#include <uno/environment.hxx> #include <uno/environment.hxx>
#include <osl/module.hxx>
#include "loadsharedlibcomponentfactory.hxx" #include "loadsharedlibcomponentfactory.hxx"
...@@ -879,40 +878,6 @@ void cppuhelper::ServiceManager::loadImplementation( ...@@ -879,40 +878,6 @@ void cppuhelper::ServiceManager::loadImplementation(
} }
} }
void cppuhelper::ServiceManager::loadImplementations()
{
rtl::OUString aUri;
osl::MutexGuard g(rBHelper.rMutex);
for (Data::NamedImplementations::const_iterator iterator(
data_.namedImplementations.begin());
iterator != data_.namedImplementations.end(); ++iterator)
{
try
{
aUri = cppu::bootstrap_expandUri(iterator->second->info->uri);
}
catch (css::lang::IllegalArgumentException& aError)
{
throw css::uno::DeploymentException(
"Cannot expand URI" + iterator->second->info->uri + ": " + aError.Message,
static_cast< cppu::OWeakObject * >(this));
}
if (iterator->second->info->loader == "com.sun.star.loader.SharedLibrary" &&
iterator->second->status != Data::Implementation::STATUS_LOADED)
{
oslModule aModule = osl_loadModule( aUri.pData, SAL_LOADMODULE_NOW | SAL_LOADMODULE_GLOBAL );
SAL_INFO("lok", "loaded component library " << aUri << ( aModule ? " ok" : " no"));
// leak aModule
// osl_unloadModule(aModule);
if ( aModule )
iterator->second->status = Data::Implementation::STATUS_LOADED;
}
}
}
void cppuhelper::ServiceManager::disposing() { void cppuhelper::ServiceManager::disposing() {
std::vector< css::uno::Reference<css::lang::XComponent> > sngls; std::vector< css::uno::Reference<css::lang::XComponent> > sngls;
std::vector< css::uno::Reference< css::lang::XComponent > > comps; std::vector< css::uno::Reference< css::lang::XComponent > > comps;
......
...@@ -203,8 +203,6 @@ public: ...@@ -203,8 +203,6 @@ public:
css::uno::Reference< css::uno::XComponentContext > const & context, css::uno::Reference< css::uno::XComponentContext > const & context,
boost::shared_ptr< Data::Implementation > & implementation); boost::shared_ptr< Data::Implementation > & implementation);
void loadImplementations();
private: private:
virtual ~ServiceManager() {} virtual ~ServiceManager() {}
......
...@@ -58,7 +58,6 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\ ...@@ -58,7 +58,6 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
ucbhelper \ ucbhelper \
utl \ utl \
vcl \ vcl \
xmlreader \
$(gb_UWINAPI) \ $(gb_UWINAPI) \
)) ))
......
...@@ -42,8 +42,6 @@ ...@@ -42,8 +42,6 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ucb/XContentProvider.hpp> #include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/ucb/XUniversalContentBroker.hpp> #include <com/sun/star/ucb/XUniversalContentBroker.hpp>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/svpforlokit.hxx> #include <vcl/svpforlokit.hxx>
...@@ -894,7 +892,7 @@ static void aBasicErrorFunc(const OUString& rError, const OUString& rAction) ...@@ -894,7 +892,7 @@ static void aBasicErrorFunc(const OUString& rError, const OUString& rAction)
fprintf(stderr, "Unexpected basic error dialog '%s'\n", aBuffer.getStr()); fprintf(stderr, "Unexpected basic error dialog '%s'\n", aBuffer.getStr());
} }
static bool initialize_uno(const OUString& aAppProgramURL, bool bPreInit) static bool initialize_uno(const OUString& aAppProgramURL)
{ {
#ifdef IOS #ifdef IOS
// For iOS we already hardocde the inifile as "rc" in the .app directory. // For iOS we already hardocde the inifile as "rc" in the .app directory.
...@@ -903,13 +901,6 @@ static bool initialize_uno(const OUString& aAppProgramURL, bool bPreInit) ...@@ -903,13 +901,6 @@ static bool initialize_uno(const OUString& aAppProgramURL, bool bPreInit)
rtl::Bootstrap::setIniFilename(aAppProgramURL + "/" SAL_CONFIGFILE("soffice")); rtl::Bootstrap::setIniFilename(aAppProgramURL + "/" SAL_CONFIGFILE("soffice"));
#endif #endif
if (bPreInit)
{
// pre-load all component libraries.
cppu::preInitBootstrap();
return true;
}
xContext = cppu::defaultBootstrap_InitialComponentContext(); xContext = cppu::defaultBootstrap_InitialComponentContext();
if (!xContext.is()) if (!xContext.is())
{ {
...@@ -973,41 +964,17 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit: ...@@ -973,41 +964,17 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit:
} }
} }
/// pre-load and parse all filter XML
static void forceLoadFilterXML()
{
}
static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfilePath) static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfilePath)
{ {
enum {
PRE_INIT, // setup shared data in master process
SECOND_INIT, // complete init. after fork
FULL_INIT // do a standard complete init.
} eStage;
// Did we do a pre-initialize
static bool bPreInited = false;
// What stage are we at ?
if (pThis == NULL)
eStage = PRE_INIT;
else if (bPreInited)
eStage = SECOND_INIT;
else
eStage = FULL_INIT;
LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
if (bInitialized) if (bInitialized)
return 1; return 1;
if (eStage != SECOND_INIT)
comphelper::LibreOfficeKit::setActive(); comphelper::LibreOfficeKit::setActive();
if (eStage != PRE_INIT)
comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib); comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib);
if (eStage != SECOND_INIT && pUserProfilePath) if (pUserProfilePath)
rtl::Bootstrap::set(OUString("UserInstallation"), OUString(pUserProfilePath, strlen(pUserProfilePath), RTL_TEXTENCODING_UTF8)); rtl::Bootstrap::set(OUString("UserInstallation"), OUString(pUserProfilePath, strlen(pUserProfilePath), RTL_TEXTENCODING_UTF8));
OUString aAppPath; OUString aAppPath;
...@@ -1029,15 +996,12 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char ...@@ -1029,15 +996,12 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
return 0; return 0;
try try
{
if (eStage != SECOND_INIT)
{ {
SAL_INFO("lok", "Attempting to initalize UNO"); SAL_INFO("lok", "Attempting to initalize UNO");
if (!initialize_uno(aAppURL))
if (!initialize_uno(aAppURL, (eStage == PRE_INIT))) {
return false; return false;
}
if (eStage != PRE_INIT)
force_c_locale(); force_c_locale();
// Force headless -- this is only for bitmap rendering. // Force headless -- this is only for bitmap rendering.
...@@ -1049,12 +1013,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char ...@@ -1049,12 +1013,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
desktop::Desktop::GetCommandLineArgs().setHeadless(); desktop::Desktop::GetCommandLineArgs().setHeadless();
Application::EnableHeadlessMode(true); Application::EnableHeadlessMode(true);
}
if (eStage == PRE_INIT)
{
forceLoadFilterXML();
}
// This is horrible crack. I really would want to go back to simply just call // This is horrible crack. I really would want to go back to simply just call
// InitVCL() here. The OfficeIPCThread thing is just horrible. // InitVCL() here. The OfficeIPCThread thing is just horrible.
...@@ -1075,8 +1033,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char ...@@ -1075,8 +1033,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// the Thread from wherever (it's done again in Desktop::Main), and can // the Thread from wherever (it's done again in Desktop::Main), and can
// then use it to wait until we're definitely ready to continue. // then use it to wait until we're definitely ready to continue.
if (eStage != PRE_INIT)
{
SAL_INFO("lok", "Enabling OfficeIPCThread"); SAL_INFO("lok", "Enabling OfficeIPCThread");
OfficeIPCThread::EnableOfficeIPCThread(); OfficeIPCThread::EnableOfficeIPCThread();
SAL_INFO("lok", "Starting soffice_main"); SAL_INFO("lok", "Starting soffice_main");
...@@ -1093,15 +1049,10 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char ...@@ -1093,15 +1049,10 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
fprintf(stderr, "LOK init failed -- restart required\n"); fprintf(stderr, "LOK init failed -- restart required\n");
return false; return false;
} }
}
if (eStage != SECOND_INIT)
ErrorHandler::RegisterDisplay(aBasicErrorFunc); ErrorHandler::RegisterDisplay(aBasicErrorFunc);
SAL_INFO("lok", "LOK Initialized"); SAL_INFO("lok", "LOK Initialized");
if (eStage == PRE_INIT)
bPreInited = true;
else
bInitialized = true; bInitialized = true;
} }
catch (css::uno::Exception& exception) catch (css::uno::Exception& exception)
...@@ -1136,12 +1087,6 @@ LibreOfficeKit *libreofficekit_hook(const char* install_path) ...@@ -1136,12 +1087,6 @@ LibreOfficeKit *libreofficekit_hook(const char* install_path)
return libreofficekit_hook_2(install_path, NULL); return libreofficekit_hook_2(install_path, NULL);
} }
SAL_JNI_EXPORT
int lok_preinit(const char* install_path, const char* user_profile_path)
{
return lo_initialize(NULL, install_path, user_profile_path);
}
static void lo_destroy(LibreOfficeKit* pThis) static void lo_destroy(LibreOfficeKit* pThis)
{ {
LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
......
...@@ -83,29 +83,7 @@ int main (int argc, char **argv) ...@@ -83,29 +83,7 @@ int main (int argc, char **argv)
return 1; return 1;
// coverity[tainted_string] - build time test tool // coverity[tainted_string] - build time test tool
char *install_path = argv[1]; Office *pOffice = lok_cpp_init( argv[1] );
if( argc > 4 )
{
fprintf( stderr, "testing preinit\n");
char *imp_lib;
void *dlhandle;
dlhandle = lok_dlopen( install_path, &imp_lib );
if( !dlhandle )
{
fprintf( stderr, "Failed to link '%s'\n", lok_dlerror() );
return -1;
}
LokHookPreInit *preinit = (LokHookPreInit *) lok_dlsym( dlhandle, "lok_preinit" );
if( !preinit )
{
fprintf( stderr, "Failed to find pre-init symbol: %s\n", lok_dlerror() );
return -1;
}
preinit( install_path, NULL );
}
Office *pOffice = lok_cpp_init( install_path );
if( !pOffice ) if( !pOffice )
{ {
fprintf( stderr, "Failed to initialize\n" ); fprintf( stderr, "Failed to initialize\n" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment