Kaydet (Commit) 8c100755 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Don't use any IPC pipe when in console-only mode or in a LOKit-based program

There is by definition no reason to do any IPC in those cases. Each program
running LO code in such a mode is independent from any other.

Do as before for Android, though, I don't have the patience now to check
whether we actually need the pipe on Android for some reason.

Change-Id: If0f54bf51e58b13c0c0b8f0bf6882bbef067960d
üst 2b9cef02
...@@ -456,6 +456,26 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() ...@@ -456,6 +456,26 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread()
rtl::Reference< OfficeIPCThread > pThread(new OfficeIPCThread); rtl::Reference< OfficeIPCThread > pThread(new OfficeIPCThread);
PipeMode nPipeMode = PIPEMODE_DONTKNOW;
#ifndef ANDROID // On Android it might be that we still for some reason need the pipe?
// When console-only (which includes in LibreOfficeKit-based programs) we want to be totally
// independent from any other LibreOffice instance or LOKit-using program. Certainly no need for
// any IPC pipes by definition, as we don't have any reason to do any IPC. Why we even call this
// EnableOfficeIPCThread function from LibreOfficeKit's lo_initialize() I am not completely
// sure, but that code, and this, is such horrible crack that I don't want to change it too much.
if (Application::IsConsoleOnly())
{
// Setting nPipeMode to PIPEMODE_CREATED causes the trivial path to be taken below, starting
// the listeing thread. (Which will immediately finish, see the execute() function, but what
// the heck...)
nPipeMode = PIPEMODE_CREATED;
}
else
#endif
{
// The name of the named pipe is created with the hashcode of the user installation directory (without /user). We have to retrieve // The name of the named pipe is created with the hashcode of the user installation directory (without /user). We have to retrieve
// this information from a unotools implementation. // this information from a unotools implementation.
::utl::Bootstrap::PathStatus aLocateResult = ::utl::Bootstrap::locateUserInstallation( aUserInstallPath ); ::utl::Bootstrap::PathStatus aLocateResult = ::utl::Bootstrap::locateUserInstallation( aUserInstallPath );
...@@ -481,11 +501,11 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() ...@@ -481,11 +501,11 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread()
{ {
aIniName = aIniName.copy( 0, lastIndex+1 ); aIniName = aIniName.copy( 0, lastIndex+1 );
aIniName += "perftune"; aIniName += "perftune";
#if defined(WNT) #if defined(WNT)
aIniName += ".ini"; aIniName += ".ini";
#else #else
aIniName += "rc"; aIniName += "rc";
#endif #endif
} }
::rtl::Bootstrap aPerfTuneIniFile( aIniName ); ::rtl::Bootstrap aPerfTuneIniFile( aIniName );
...@@ -514,7 +534,6 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() ...@@ -514,7 +534,6 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread()
OUString aPipeIdent( "SingleOfficeIPC_" + aUserInstallPathHashCode ); OUString aPipeIdent( "SingleOfficeIPC_" + aUserInstallPathHashCode );
PipeMode nPipeMode = PIPEMODE_DONTKNOW;
do do
{ {
osl::Security &rSecurity = Security::get(); osl::Security &rSecurity = Security::get();
...@@ -556,6 +575,7 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() ...@@ -556,6 +575,7 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread()
} }
} while ( nPipeMode == PIPEMODE_DONTKNOW ); } while ( nPipeMode == PIPEMODE_DONTKNOW );
}
if ( nPipeMode == PIPEMODE_CREATED ) if ( nPipeMode == PIPEMODE_CREATED )
{ {
...@@ -684,6 +704,12 @@ bool OfficeIPCThread::IsEnabled() ...@@ -684,6 +704,12 @@ bool OfficeIPCThread::IsEnabled()
void OfficeIPCThread::execute() void OfficeIPCThread::execute()
{ {
#if HAVE_FEATURE_DESKTOP || defined(ANDROID) #if HAVE_FEATURE_DESKTOP || defined(ANDROID)
#ifndef ANDROID
if (Application::IsConsoleOnly())
return;
#endif
do do
{ {
osl::StreamPipe aStreamPipe; osl::StreamPipe aStreamPipe;
......
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