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

There's only a single DispatchWatcher, no need for a static mutex member

Change-Id: I410d07210bd80379fd2de1b8d76843794fa5f660
üst 32e70912
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
#include <osl/thread.hxx> #include <osl/thread.hxx>
#include <osl/file.hxx> #include <osl/file.hxx>
#include <osl/file.h> #include <osl/file.h>
#include <rtl/instance.hxx>
#include <iostream> #include <iostream>
using namespace ::osl; using namespace ::osl;
...@@ -170,16 +169,6 @@ OUString impl_GuessFilter( const OUString& rUrlOut, const OUString& rDocService ...@@ -170,16 +169,6 @@ OUString impl_GuessFilter( const OUString& rUrlOut, const OUString& rDocService
} }
namespace
{
class theWatcherMutex : public rtl::Static<Mutex, theWatcherMutex> {};
}
Mutex& DispatchWatcher::GetMutex()
{
return theWatcherMutex::get();
}
DispatchWatcher::DispatchWatcher() DispatchWatcher::DispatchWatcher()
: m_nRequestCount(0) : m_nRequestCount(0)
{ {
...@@ -317,7 +306,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ ...@@ -317,7 +306,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ
if( xDispatcher.is() ) if( xDispatcher.is() )
{ {
{ {
::osl::ClearableMutexGuard aGuard( GetMutex() ); ::osl::ClearableMutexGuard aGuard(m_mutex);
// Remember request so we can find it in statusChanged! // Remember request so we can find it in statusChanged!
m_aRequestContainer.emplace(aURL.Complete, 1); m_aRequestContainer.emplace(aURL.Complete, 1);
m_nRequestCount++; m_nRequestCount++;
...@@ -698,7 +687,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ ...@@ -698,7 +687,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ
xDisp->dispatchWithNotification( aDispatches[n].aURL, aArgs, this ); xDisp->dispatchWithNotification( aDispatches[n].aURL, aArgs, this );
else else
{ {
::osl::ClearableMutexGuard aGuard( GetMutex() ); ::osl::ClearableMutexGuard aGuard(m_mutex);
m_nRequestCount--; m_nRequestCount--;
aGuard.clear(); aGuard.clear();
xDispatch->dispatch( aDispatches[n].aURL, aArgs ); xDispatch->dispatch( aDispatches[n].aURL, aArgs );
...@@ -706,7 +695,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ ...@@ -706,7 +695,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ
} }
} }
::osl::ClearableMutexGuard aGuard( GetMutex() ); ::osl::ClearableMutexGuard aGuard(m_mutex);
bool bEmpty = (m_nRequestCount == 0); bool bEmpty = (m_nRequestCount == 0);
aGuard.clear(); aGuard.clear();
...@@ -738,7 +727,7 @@ void SAL_CALL DispatchWatcher::disposing( const css::lang::EventObject& ) ...@@ -738,7 +727,7 @@ void SAL_CALL DispatchWatcher::disposing( const css::lang::EventObject& )
void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) throw( RuntimeException, std::exception ) void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) throw( RuntimeException, std::exception )
{ {
osl::ClearableMutexGuard aGuard( GetMutex() ); osl::ClearableMutexGuard aGuard(m_mutex);
sal_Int16 nCount = --m_nRequestCount; sal_Int16 nCount = --m_nRequestCount;
aGuard.clear(); aGuard.clear();
OfficeIPCThread::RequestsCompleted(); OfficeIPCThread::RequestsCompleted();
......
...@@ -85,7 +85,7 @@ class DispatchWatcher : public ::cppu::WeakImplHelper< css::frame::XDispatchResu ...@@ -85,7 +85,7 @@ class DispatchWatcher : public ::cppu::WeakImplHelper< css::frame::XDispatchResu
bool executeDispatchRequests( const DispatchList& aDispatches, bool bNoTerminate = false ); bool executeDispatchRequests( const DispatchList& aDispatches, bool bNoTerminate = false );
private: private:
static ::osl::Mutex& GetMutex(); osl::Mutex m_mutex;
std::unordered_map<OUString, sal_Int32, OUStringHash> std::unordered_map<OUString, sal_Int32, OUStringHash>
m_aRequestContainer; m_aRequestContainer;
......
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