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(
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 >
......@@ -119,9 +107,4 @@ cppu::defaultBootstrap_InitialComponentContext()
return defaultBootstrap_InitialComponentContext(getUnoIniUri());
}
void
cppu::preInitBootstrap()
{
default_preInitBootstrap(getUnoIniUri());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -423,7 +423,6 @@ global:
# enableChangeListenerNotification
_ZN4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
_ZThn*_N4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
_ZN4cppu16preInitBootstrapEv;
} UDK_3.7;
LIBO_UDK_3.9 { # LibO 3.7
......
......@@ -42,7 +42,6 @@
#include <rtl/strbuf.hxx>
#include <sal/log.hxx>
#include <uno/environment.hxx>
#include <osl/module.hxx>
#include "loadsharedlibcomponentfactory.hxx"
......@@ -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() {
std::vector< css::uno::Reference<css::lang::XComponent> > sngls;
std::vector< css::uno::Reference< css::lang::XComponent > > comps;
......
......@@ -203,8 +203,6 @@ public:
css::uno::Reference< css::uno::XComponentContext > const & context,
boost::shared_ptr< Data::Implementation > & implementation);
void loadImplementations();
private:
virtual ~ServiceManager() {}
......
......@@ -58,7 +58,6 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
ucbhelper \
utl \
vcl \
xmlreader \
$(gb_UWINAPI) \
))
......
......@@ -42,8 +42,6 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ucb/XContentProvider.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/svpforlokit.hxx>
......@@ -894,7 +892,7 @@ static void aBasicErrorFunc(const OUString& rError, const OUString& rAction)
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
// 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)
rtl::Bootstrap::setIniFilename(aAppProgramURL + "/" SAL_CONFIGFILE("soffice"));
#endif
if (bPreInit)
{
// pre-load all component libraries.
cppu::preInitBootstrap();
return true;
}
xContext = cppu::defaultBootstrap_InitialComponentContext();
if (!xContext.is())
{
......@@ -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)
{
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);
if (bInitialized)
return 1;
if (eStage != SECOND_INIT)
comphelper::LibreOfficeKit::setActive();
if (eStage != PRE_INIT)
comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib);
comphelper::LibreOfficeKit::setActive();
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));
OUString aAppPath;
......@@ -1030,31 +997,22 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
try
{
if (eStage != SECOND_INIT)
SAL_INFO("lok", "Attempting to initalize UNO");
if (!initialize_uno(aAppURL))
{
SAL_INFO("lok", "Attempting to initalize UNO");
if (!initialize_uno(aAppURL, (eStage == PRE_INIT)))
return false;
if (eStage != PRE_INIT)
force_c_locale();
// Force headless -- this is only for bitmap rendering.
rtl::Bootstrap::set("SAL_USE_VCLPLUGIN", "svp");
return false;
}
force_c_locale();
// We specifically need to make sure we have the "headless"
// command arg set (various code specifically checks via
// CommandLineArgs):
desktop::Desktop::GetCommandLineArgs().setHeadless();
// Force headless -- this is only for bitmap rendering.
rtl::Bootstrap::set("SAL_USE_VCLPLUGIN", "svp");
Application::EnableHeadlessMode(true);
}
// We specifically need to make sure we have the "headless"
// command arg set (various code specifically checks via
// CommandLineArgs):
desktop::Desktop::GetCommandLineArgs().setHeadless();
if (eStage == PRE_INIT)
{
forceLoadFilterXML();
}
Application::EnableHeadlessMode(true);
// This is horrible crack. I really would want to go back to simply just call
// InitVCL() here. The OfficeIPCThread thing is just horrible.
......@@ -1075,34 +1033,27 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// 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.
if (eStage != PRE_INIT)
SAL_INFO("lok", "Enabling OfficeIPCThread");
OfficeIPCThread::EnableOfficeIPCThread();
SAL_INFO("lok", "Starting soffice_main");
pLib->maThread = osl_createThread(lo_startmain, NULL);
SAL_INFO("lok", "Waiting for OfficeIPCThread");
OfficeIPCThread::WaitForReady();
SAL_INFO("lok", "OfficeIPCThread ready -- continuing");
// If the Thread has been disabled again that indicates that a
// restart is required (or in any case we don't have a useable
// process around).
if (!OfficeIPCThread::IsEnabled())
{
SAL_INFO("lok", "Enabling OfficeIPCThread");
OfficeIPCThread::EnableOfficeIPCThread();
SAL_INFO("lok", "Starting soffice_main");
pLib->maThread = osl_createThread(lo_startmain, NULL);
SAL_INFO("lok", "Waiting for OfficeIPCThread");
OfficeIPCThread::WaitForReady();
SAL_INFO("lok", "OfficeIPCThread ready -- continuing");
// If the Thread has been disabled again that indicates that a
// restart is required (or in any case we don't have a useable
// process around).
if (!OfficeIPCThread::IsEnabled())
{
fprintf(stderr, "LOK init failed -- restart required\n");
return false;
}
fprintf(stderr, "LOK init failed -- restart required\n");
return false;
}
if (eStage != SECOND_INIT)
ErrorHandler::RegisterDisplay(aBasicErrorFunc);
ErrorHandler::RegisterDisplay(aBasicErrorFunc);
SAL_INFO("lok", "LOK Initialized");
if (eStage == PRE_INIT)
bPreInited = true;
else
bInitialized = true;
bInitialized = true;
}
catch (css::uno::Exception& exception)
{
......@@ -1136,12 +1087,6 @@ LibreOfficeKit *libreofficekit_hook(const char* install_path)
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)
{
LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
......
......@@ -83,29 +83,7 @@ int main (int argc, char **argv)
return 1;
// coverity[tainted_string] - build time test tool
char *install_path = 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 );
Office *pOffice = lok_cpp_init( argv[1] );
if( !pOffice )
{
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