summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-03-11 15:34:01 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-03-11 16:41:59 +0100
commitee31139b64eb9517619578bb02b3261b85d635ae (patch)
tree5942d77a1fccf262505538f53787001cbdcaca15
parentf3caa92527aee3c95960e95c90e1e1cdd33f1342 (diff)
Combine mbDowning, mbRequestsEnabled as mState
Change-Id: I3110f1690f0d7b0f19e7576f02cb1159342881a1
-rw-r--r--desktop/source/app/officeipcthread.cxx15
-rw-r--r--desktop/source/app/officeipcthread.hxx7
2 files changed, 12 insertions, 10 deletions
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index 6c41f12c4e17..00d0147edc08 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -391,7 +391,7 @@ void OfficeIPCThread::SetDowning()
::osl::MutexGuard aGuard( GetMutex() );
if ( pGlobalOfficeIPCThread.is() )
- pGlobalOfficeIPCThread->mbDowning = true;
+ pGlobalOfficeIPCThread->mState = State::Downing;
}
static bool s_bInEnableRequests = false;
@@ -404,7 +404,9 @@ void OfficeIPCThread::EnableRequests()
if ( pGlobalOfficeIPCThread.is() )
{
s_bInEnableRequests = true;
- pGlobalOfficeIPCThread->mbRequestsEnabled = true;
+ if (pGlobalOfficeIPCThread->mState != State::Downing) {
+ pGlobalOfficeIPCThread->mState = State::RequestsEnabled;
+ }
// hit the compiler over the head
ProcessDocumentsRequest aEmptyReq = ProcessDocumentsRequest( boost::optional< OUString >() );
// trigger already queued requests
@@ -634,7 +636,7 @@ void OfficeIPCThread::DisableOfficeIPCThread(bool join)
pGlobalOfficeIPCThread);
pGlobalOfficeIPCThread.clear();
- pOfficeIPCThread->mbDowning = true;
+ pOfficeIPCThread->mState = State::Downing;
pOfficeIPCThread->maPipe.close();
// release mutex to avoid deadlocks
@@ -652,8 +654,7 @@ void OfficeIPCThread::DisableOfficeIPCThread(bool join)
OfficeIPCThread::OfficeIPCThread() :
Thread( "OfficeIPCThread" ),
- mbDowning( false ),
- mbRequestsEnabled( false ),
+ mState( State::Starting ),
mnPendingRequests( 0 )
{
}
@@ -722,7 +723,7 @@ void OfficeIPCThread::execute()
// down during wait
osl::ClearableMutexGuard aGuard( GetMutex() );
- if ( mbDowning )
+ if ( mState == State::Downing )
{
break;
}
@@ -963,7 +964,7 @@ void OfficeIPCThread::execute()
{
{
osl::MutexGuard aGuard( GetMutex() );
- if ( mbDowning )
+ if ( mState == State::Downing )
{
break;
}
diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx
index b8770c69fc9a..13af93747bfe 100644
--- a/desktop/source/app/officeipcthread.hxx
+++ b/desktop/source/app/officeipcthread.hxx
@@ -72,9 +72,10 @@ class OfficeIPCThread : public salhelper::Thread
private:
static rtl::Reference< OfficeIPCThread > pGlobalOfficeIPCThread;
+ enum class State { Starting, RequestsEnabled, Downing };
+
osl::Pipe maPipe;
- bool mbDowning;
- bool mbRequestsEnabled;
+ State mState;
int mnPendingRequests;
rtl::Reference<DispatchWatcher> mpDispatchWatcher;
@@ -121,7 +122,7 @@ class OfficeIPCThread : public salhelper::Thread
static void WaitForReady();
static bool IsEnabled();
- bool AreRequestsEnabled() const { return mbRequestsEnabled && ! mbDowning; }
+ bool AreRequestsEnabled() const { return mState == State::RequestsEnabled; }
};