Kaydet (Commit) dde79dd5 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Rename OfficeIPCThread to RequestHandler

Change-Id: I2076d903e83a0b8eb3aa0ce2413630e2c5415b15
üst a91272a6
...@@ -112,8 +112,8 @@ bool DeletedSpecial::VisitCXXMethodDecl(CXXMethodDecl const * decl) { ...@@ -112,8 +112,8 @@ bool DeletedSpecial::VisitCXXMethodDecl(CXXMethodDecl const * decl) {
|| whitelist(decl, "SwLineInfo", "sw/source/core/text/inftxt.hxx") || whitelist(decl, "SwLineInfo", "sw/source/core/text/inftxt.hxx")
|| whitelist(decl, "XRenderPeer", "vcl/unx/generic/gdi/xrender_peer.hxx") || whitelist(decl, "XRenderPeer", "vcl/unx/generic/gdi/xrender_peer.hxx")
|| whitelist(decl, "desktop::DispatchWatcher", "desktop/source/app/dispatchwatcher.hxx") || whitelist(decl, "desktop::DispatchWatcher", "desktop/source/app/dispatchwatcher.hxx")
|| whitelist(decl, "desktop::OfficeIPCThread", "desktop/source/app/officeipcthread.hxx") || whitelist(decl, "desktop::RequestHandler", "desktop/source/app/officeipcthread.hxx")
|| whitelist(decl, "desktop::OfficeIPCThread", "desktop/source/lib/../app/officeipcthread.hxx") || whitelist(decl, "desktop::RequestHandler", "desktop/source/lib/../app/officeipcthread.hxx")
|| whitelist(decl, "sd::DiscoveryService", "sd/source/ui/remotecontrol/DiscoveryService.hxx") || whitelist(decl, "sd::DiscoveryService", "sd/source/ui/remotecontrol/DiscoveryService.hxx")
|| whitelist(decl, "sd::IconCache", "sd/source/ui/inc/tools/IconCache.hxx") || whitelist(decl, "sd::IconCache", "sd/source/ui/inc/tools/IconCache.hxx")
|| whitelist(decl, "sd::RemoteServer", "sd/source/ui/inc/RemoteServer.hxx") || whitelist(decl, "sd::RemoteServer", "sd/source/ui/inc/RemoteServer.hxx")
......
...@@ -199,7 +199,7 @@ namespace { ...@@ -199,7 +199,7 @@ namespace {
// removed cache data is recreated. // removed cache data is recreated.
// //
// Multiple instances of soffice.bin can execute this code in parallel for a // Multiple instances of soffice.bin can execute this code in parallel for a
// single UserInstallation, as it is called before OfficeIPCThread is set up. // single UserInstallation, as it is called before RequestHandler is set up.
// Therefore, any errors here only lead to SAL_WARNs. // Therefore, any errors here only lead to SAL_WARNs.
// //
// At least in theory, this function could be removed again once no // At least in theory, this function could be removed again once no
...@@ -576,8 +576,8 @@ void Desktop::Init() ...@@ -576,8 +576,8 @@ void Desktop::Init()
const CommandLineArgs& rCmdLineArgs = GetCommandLineArgs(); const CommandLineArgs& rCmdLineArgs = GetCommandLineArgs();
// start ipc thread only for non-remote offices // start ipc thread only for non-remote offices
OfficeIPCThread::Status aStatus = OfficeIPCThread::EnableOfficeIPCThread(); RequestHandler::Status aStatus = RequestHandler::Enable();
if ( aStatus == OfficeIPCThread::IPC_STATUS_PIPE_ERROR ) if ( aStatus == RequestHandler::IPC_STATUS_PIPE_ERROR )
{ {
#if HAVE_FEATURE_MACOSX_SANDBOX #if HAVE_FEATURE_MACOSX_SANDBOX
// In a sandboxed LO, on 10.8.2 at least, creating the // In a sandboxed LO, on 10.8.2 at least, creating the
...@@ -599,11 +599,11 @@ void Desktop::Init() ...@@ -599,11 +599,11 @@ void Desktop::Init()
SetBootstrapError( BE_PATHINFO_MISSING, OUString() ); SetBootstrapError( BE_PATHINFO_MISSING, OUString() );
#endif #endif
} }
else if ( aStatus == OfficeIPCThread::IPC_STATUS_BOOTSTRAP_ERROR ) else if ( aStatus == RequestHandler::IPC_STATUS_BOOTSTRAP_ERROR )
{ {
SetBootstrapError( BE_PATHINFO_MISSING, OUString() ); SetBootstrapError( BE_PATHINFO_MISSING, OUString() );
} }
else if ( aStatus == OfficeIPCThread::IPC_STATUS_2ND_OFFICE ) else if ( aStatus == RequestHandler::IPC_STATUS_2ND_OFFICE )
{ {
// 2nd office startup should terminate after sending cmdlineargs through pipe // 2nd office startup should terminate after sending cmdlineargs through pipe
SetBootstrapStatus(BS_TERMINATE); SetBootstrapStatus(BS_TERMINATE);
...@@ -612,7 +612,7 @@ void Desktop::Init() ...@@ -612,7 +612,7 @@ void Desktop::Init()
|| rCmdLineArgs.IsHelp() || rCmdLineArgs.IsVersion() ) || rCmdLineArgs.IsHelp() || rCmdLineArgs.IsVersion() )
{ {
// disable IPC thread in an instance that is just showing a help message // disable IPC thread in an instance that is just showing a help message
OfficeIPCThread::DisableOfficeIPCThread(); RequestHandler::Disable();
} }
pSignalHandler = osl_addSignalHandler(SalMainPipeExchangeSignal_impl, nullptr); pSignalHandler = osl_addSignalHandler(SalMainPipeExchangeSignal_impl, nullptr);
} }
...@@ -641,7 +641,7 @@ void Desktop::DeInit() ...@@ -641,7 +641,7 @@ void Desktop::DeInit()
// clear lockfile // clear lockfile
m_xLockfile.reset(); m_xLockfile.reset();
OfficeIPCThread::DisableOfficeIPCThread(); RequestHandler::Disable();
if( pSignalHandler ) if( pSignalHandler )
osl_removeSignalHandler( pSignalHandler ); osl_removeSignalHandler( pSignalHandler );
} catch (const RuntimeException&) { } catch (const RuntimeException&) {
...@@ -677,9 +677,9 @@ bool Desktop::QueryExit() ...@@ -677,9 +677,9 @@ bool Desktop::QueryExit()
FlushConfiguration(); FlushConfiguration();
try try
{ {
// it is no problem to call DisableOfficeIPCThread() more than once // it is no problem to call RequestHandler::Disable() more than once
// it also looks to be threadsafe // it also looks to be threadsafe
OfficeIPCThread::DisableOfficeIPCThread(); RequestHandler::Disable();
} }
catch ( const RuntimeException& ) catch ( const RuntimeException& )
{ {
...@@ -1154,7 +1154,7 @@ namespace { ...@@ -1154,7 +1154,7 @@ namespace {
void restartOnMac(bool passArguments) { void restartOnMac(bool passArguments) {
#if defined MACOSX #if defined MACOSX
OfficeIPCThread::DisableOfficeIPCThread(); RequestHandler::Disable();
#if HAVE_FEATURE_MACOSX_SANDBOX #if HAVE_FEATURE_MACOSX_SANDBOX
(void) passArguments; // avoid warnings (void) passArguments; // avoid warnings
ResMgr *resMgr = Desktop::GetDesktopResManager(); ResMgr *resMgr = Desktop::GetDesktopResManager();
...@@ -1279,7 +1279,7 @@ void Desktop::Exception(sal_uInt16 nError) ...@@ -1279,7 +1279,7 @@ void Desktop::Exception(sal_uInt16 nError)
if( bRestart ) if( bRestart )
{ {
OfficeIPCThread::DisableOfficeIPCThread(); RequestHandler::Disable();
if( pSignalHandler ) if( pSignalHandler )
osl_removeSignalHandler( pSignalHandler ); osl_removeSignalHandler( pSignalHandler );
...@@ -1613,7 +1613,7 @@ int Desktop::Main() ...@@ -1613,7 +1613,7 @@ int Desktop::Main()
try try
{ {
if ( xDesktop.is() ) if ( xDesktop.is() )
xDesktop->addTerminateListener( new OfficeIPCThreadController ); xDesktop->addTerminateListener( new RequestHandlerController );
SetSplashScreenProgress(100); SetSplashScreenProgress(100);
} }
catch ( const css::uno::Exception& e ) catch ( const css::uno::Exception& e )
...@@ -1659,27 +1659,27 @@ int Desktop::Main() ...@@ -1659,27 +1659,27 @@ int Desktop::Main()
} }
catch(const css::document::CorruptedFilterConfigurationException& exFilterCfg) catch(const css::document::CorruptedFilterConfigurationException& exFilterCfg)
{ {
OfficeIPCThread::SetDowning(); RequestHandler::SetDowning();
FatalError( MakeStartupErrorMessage(exFilterCfg.Message) ); FatalError( MakeStartupErrorMessage(exFilterCfg.Message) );
} }
catch(const css::configuration::CorruptedConfigurationException& exAnyCfg) catch(const css::configuration::CorruptedConfigurationException& exAnyCfg)
{ {
OfficeIPCThread::SetDowning(); RequestHandler::SetDowning();
FatalError( MakeStartupErrorMessage(exAnyCfg.Message) ); FatalError( MakeStartupErrorMessage(exAnyCfg.Message) );
} }
catch( const css::uno::Exception& exUNO) catch( const css::uno::Exception& exUNO)
{ {
OfficeIPCThread::SetDowning(); RequestHandler::SetDowning();
FatalError( exUNO.Message); FatalError( exUNO.Message);
} }
catch( const std::exception& exSTD) catch( const std::exception& exSTD)
{ {
OfficeIPCThread::SetDowning(); RequestHandler::SetDowning();
FatalError( OUString::createFromAscii( exSTD.what())); FatalError( OUString::createFromAscii( exSTD.what()));
} }
catch( ...) catch( ...)
{ {
OfficeIPCThread::SetDowning(); RequestHandler::SetDowning();
FatalError( "Caught Unknown Exception: Aborting!"); FatalError( "Caught Unknown Exception: Aborting!");
} }
} }
...@@ -1943,7 +1943,7 @@ IMPL_LINK_NOARG_TYPED(Desktop, OpenClients_Impl, void*, void) ...@@ -1943,7 +1943,7 @@ IMPL_LINK_NOARG_TYPED(Desktop, OpenClients_Impl, void*, void)
try { try {
OpenClients(); OpenClients();
OfficeIPCThread::SetReady(); RequestHandler::SetReady();
CloseSplashScreen(); CloseSplashScreen();
CheckFirstRun( ); CheckFirstRun( );
...@@ -2351,7 +2351,7 @@ void Desktop::OpenClients() ...@@ -2351,7 +2351,7 @@ void Desktop::OpenClients()
CrashReporter::writeCommonInfo(); CrashReporter::writeCommonInfo();
#endif #endif
OfficeIPCThread::EnableRequests(); RequestHandler::EnableRequests();
ProcessDocumentsRequest aRequest(rArgs.getCwdUrl()); ProcessDocumentsRequest aRequest(rArgs.getCwdUrl());
aRequest.aOpenList = rArgs.GetOpenList(); aRequest.aOpenList = rArgs.GetOpenList();
...@@ -2407,7 +2407,7 @@ void Desktop::OpenClients() ...@@ -2407,7 +2407,7 @@ void Desktop::OpenClients()
} }
// Process request // Process request
if ( OfficeIPCThread::ExecuteCmdLineRequests(aRequest, false) ) if ( RequestHandler::ExecuteCmdLineRequests(aRequest, false) )
{ {
// Don't do anything if we have successfully called terminate at desktop: // Don't do anything if we have successfully called terminate at desktop:
return; return;
...@@ -2481,7 +2481,7 @@ void Desktop::OpenDefault() ...@@ -2481,7 +2481,7 @@ void Desktop::OpenDefault()
ProcessDocumentsRequest aRequest(rArgs.getCwdUrl()); ProcessDocumentsRequest aRequest(rArgs.getCwdUrl());
aRequest.aOpenList.push_back(aName); aRequest.aOpenList.push_back(aName);
OfficeIPCThread::ExecuteCmdLineRequests(aRequest, false); RequestHandler::ExecuteCmdLineRequests(aRequest, false);
} }
...@@ -2604,7 +2604,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) ...@@ -2604,7 +2604,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
std::vector<OUString> const & data(rAppEvent.GetStringsData()); std::vector<OUString> const & data(rAppEvent.GetStringsData());
docsRequest.aOpenList.insert( docsRequest.aOpenList.insert(
docsRequest.aOpenList.end(), data.begin(), data.end()); docsRequest.aOpenList.end(), data.begin(), data.end());
OfficeIPCThread::ExecuteCmdLineRequests(docsRequest, false); RequestHandler::ExecuteCmdLineRequests(docsRequest, false);
} }
} }
break; break;
...@@ -2621,7 +2621,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) ...@@ -2621,7 +2621,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
std::vector<OUString> const & data(rAppEvent.GetStringsData()); std::vector<OUString> const & data(rAppEvent.GetStringsData());
docsRequest.aPrintList.insert( docsRequest.aPrintList.insert(
docsRequest.aPrintList.end(), data.begin(), data.end()); docsRequest.aPrintList.end(), data.begin(), data.end());
OfficeIPCThread::ExecuteCmdLineRequests(docsRequest, false); RequestHandler::ExecuteCmdLineRequests(docsRequest, false);
} }
} }
break; break;
......
...@@ -201,7 +201,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest ...@@ -201,7 +201,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
{ {
bSetInputFilter = true; bSetInputFilter = true;
aForcedInputFilter = aDispatchRequest.aURL; aForcedInputFilter = aDispatchRequest.aURL;
OfficeIPCThread::RequestsCompleted(); RequestHandler::RequestsCompleted();
continue; continue;
} }
...@@ -438,7 +438,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest ...@@ -438,7 +438,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
aDispatchRequest.aRequestType == REQUEST_FORCENEW ) aDispatchRequest.aRequestType == REQUEST_FORCENEW )
{ {
// request is completed // request is completed
OfficeIPCThread::RequestsCompleted(); RequestHandler::RequestsCompleted();
} }
else if ( aDispatchRequest.aRequestType == REQUEST_PRINT || else if ( aDispatchRequest.aRequestType == REQUEST_PRINT ||
aDispatchRequest.aRequestType == REQUEST_PRINTTO || aDispatchRequest.aRequestType == REQUEST_PRINTTO ||
...@@ -662,7 +662,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest ...@@ -662,7 +662,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
} }
// request is completed // request is completed
OfficeIPCThread::RequestsCompleted(); RequestHandler::RequestsCompleted();
} }
} }
} }
...@@ -727,8 +727,8 @@ void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) th ...@@ -727,8 +727,8 @@ void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) th
osl::ClearableMutexGuard aGuard(m_mutex); osl::ClearableMutexGuard aGuard(m_mutex);
sal_Int16 nCount = --m_nRequestCount; sal_Int16 nCount = --m_nRequestCount;
aGuard.clear(); aGuard.clear();
OfficeIPCThread::RequestsCompleted(); RequestHandler::RequestsCompleted();
if ( !nCount && !OfficeIPCThread::AreRequestsPending() ) if ( !nCount && !RequestHandler::AreRequestsPending() )
{ {
// We have to check if we have an open task otherwise we have to shutdown the office. // We have to check if we have an open task otherwise we have to shutdown the office.
Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() ); Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() );
......
...@@ -69,12 +69,12 @@ struct ProcessDocumentsRequest ...@@ -69,12 +69,12 @@ struct ProcessDocumentsRequest
class DispatchWatcher; class DispatchWatcher;
class PipeReaderThread; class PipeReaderThread;
class OfficeIPCThread: public salhelper::SimpleReferenceObject class RequestHandler: public salhelper::SimpleReferenceObject
{ {
friend PipeReaderThread; friend PipeReaderThread;
private: private:
static rtl::Reference< OfficeIPCThread > pGlobalOfficeIPCThread; static rtl::Reference< RequestHandler > pGlobal;
enum class State { Starting, RequestsEnabled, Downing }; enum class State { Starting, RequestsEnabled, Downing };
...@@ -93,9 +93,9 @@ class OfficeIPCThread: public salhelper::SimpleReferenceObject ...@@ -93,9 +93,9 @@ class OfficeIPCThread: public salhelper::SimpleReferenceObject
static ::osl::Mutex& GetMutex(); static ::osl::Mutex& GetMutex();
OfficeIPCThread(); RequestHandler();
virtual ~OfficeIPCThread(); virtual ~RequestHandler();
public: public:
enum Status enum Status
...@@ -115,8 +115,8 @@ class OfficeIPCThread: public salhelper::SimpleReferenceObject ...@@ -115,8 +115,8 @@ class OfficeIPCThread: public salhelper::SimpleReferenceObject
ProcessDocumentsRequest&, bool noTerminate); ProcessDocumentsRequest&, bool noTerminate);
// return sal_False if second office // return sal_False if second office
static Status EnableOfficeIPCThread(); static Status Enable();
static void DisableOfficeIPCThread(bool join = true); static void Disable(bool join = true);
// start dispatching events... // start dispatching events...
static void SetReady(); static void SetReady();
static void WaitForReady(); static void WaitForReady();
...@@ -126,13 +126,13 @@ class OfficeIPCThread: public salhelper::SimpleReferenceObject ...@@ -126,13 +126,13 @@ class OfficeIPCThread: public salhelper::SimpleReferenceObject
}; };
class OfficeIPCThreadController : public ::cppu::WeakImplHelper< class RequestHandlerController : public ::cppu::WeakImplHelper<
css::lang::XServiceInfo, css::lang::XServiceInfo,
css::frame::XTerminateListener > css::frame::XTerminateListener >
{ {
public: public:
OfficeIPCThreadController() {} RequestHandlerController() {}
virtual ~OfficeIPCThreadController() {} virtual ~RequestHandlerController() {}
// XServiceInfo // XServiceInfo
virtual OUString SAL_CALL getImplementationName() virtual OUString SAL_CALL getImplementationName()
......
...@@ -1921,7 +1921,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char ...@@ -1921,7 +1921,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
} }
// 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 RequestHandler thing is just horrible.
// We could use InitVCL() here -- and used to before using soffice_main, // We could use InitVCL() here -- and used to before using soffice_main,
// however that now deals with the initialisation for us (and it's not // however that now deals with the initialisation for us (and it's not
...@@ -1934,25 +1934,25 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char ...@@ -1934,25 +1934,25 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// functions depend on VCL being ready -- the deadlocks would happen // functions depend on VCL being ready -- the deadlocks would happen
// if you try to use loadDocument too early. // if you try to use loadDocument too early.
// The OfficeIPCThread is specifically set to be ready when all the other // The RequestHandler is specifically set to be ready when all the other
// init in Desktop::Main (run from soffice_main) is done. We can "enable" // init in Desktop::Main (run from soffice_main) is done. We can "enable"
// 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) if (eStage != PRE_INIT)
{ {
SAL_INFO("lok", "Enabling OfficeIPCThread"); SAL_INFO("lok", "Enabling RequestHandler");
OfficeIPCThread::EnableOfficeIPCThread(); RequestHandler::Enable();
SAL_INFO("lok", "Starting soffice_main"); SAL_INFO("lok", "Starting soffice_main");
pLib->maThread = osl_createThread(lo_startmain, nullptr); pLib->maThread = osl_createThread(lo_startmain, nullptr);
SAL_INFO("lok", "Waiting for OfficeIPCThread"); SAL_INFO("lok", "Waiting for RequestHandler");
OfficeIPCThread::WaitForReady(); RequestHandler::WaitForReady();
SAL_INFO("lok", "OfficeIPCThread ready -- continuing"); SAL_INFO("lok", "RequestHandler ready -- continuing");
// If the Thread has been disabled again that indicates that a // If the Thread has been disabled again that indicates that a
// restart is required (or in any case we don't have a useable // restart is required (or in any case we don't have a useable
// process around). // process around).
if (!OfficeIPCThread::IsEnabled()) if (!RequestHandler::IsEnabled())
{ {
fprintf(stderr, "LOK init failed -- restart required\n"); fprintf(stderr, "LOK init failed -- restart required\n");
return false; return false;
......
...@@ -385,7 +385,7 @@ void SAL_CALL Desktop::addTerminateListener( const css::uno::Reference< css::fra ...@@ -385,7 +385,7 @@ void SAL_CALL Desktop::addTerminateListener( const css::uno::Reference< css::fra
m_xSfxTerminator = xListener; m_xSfxTerminator = xListener;
return; return;
} }
if( sImplementationName == "com.sun.star.comp.OfficeIPCThreadController" ) if( sImplementationName == "com.sun.star.comp.RequestHandlerController" )
{ {
m_xPipeTerminator = xListener; m_xPipeTerminator = xListener;
return; return;
...@@ -424,7 +424,7 @@ void SAL_CALL Desktop::removeTerminateListener( const css::uno::Reference< css:: ...@@ -424,7 +424,7 @@ void SAL_CALL Desktop::removeTerminateListener( const css::uno::Reference< css::
return; return;
} }
if( sImplementationName == "com.sun.star.comp.OfficeIPCThreadController" ) if( sImplementationName == "com.sun.star.comp.RequestHandlerController" )
{ {
m_xPipeTerminator.clear(); m_xPipeTerminator.clear();
return; return;
......
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