Remove unnecessary vcl::SolarMutexObject

Change-Id: I6dfdd7d5d211b66019dfbe364101140e28a3584d
This commit is contained in:
Stephan Bergmann 2014-03-20 18:10:51 +01:00
parent 36be3d94c2
commit ad28ffaa37
11 changed files with 22 additions and 138 deletions

View File

@ -1,65 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_VCL_SOLARMUTEX_HXX
#define INCLUDED_VCL_SOLARMUTEX_HXX
#include <comphelper/solarmutex.hxx>
#include <osl/mutex.h>
#include <vcl/dllapi.h>
namespace vcl
{
/** Implementation of the SolarMutex interface.
*/
class VCL_DLLPUBLIC SolarMutexObject : public comphelper::SolarMutex
{
public:
//static SolarMutex& SAL_CALL getGlobalMutex();
/** Creates mutex
*/
SolarMutexObject();
/** Implicitly destroys mutex
*/
virtual ~SolarMutexObject();
virtual void acquire();
virtual void release();
virtual bool tryToAcquire();
protected:
oslMutex m_solarMutex;
private:
/* Disable copy/assignment
*/
SolarMutexObject( const SolarMutexObject& );
SolarMutexObject& SAL_CALL operator=( const SolarMutexObject& );
};
}
#endif // INCLUDED_VCL_SOLARMUTEX_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -113,7 +113,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/app/IconThemeInfo \ vcl/source/app/IconThemeInfo \
vcl/source/app/IconThemeScanner \ vcl/source/app/IconThemeScanner \
vcl/source/app/IconThemeSelector \ vcl/source/app/IconThemeSelector \
vcl/source/app/solarmutex \
vcl/source/app/sound \ vcl/source/app/sound \
vcl/source/app/stdtext \ vcl/source/app/stdtext \
vcl/source/app/svapp \ vcl/source/app/svapp \

View File

@ -46,7 +46,7 @@ SalYieldMutex::~SalYieldMutex()
void SalYieldMutex::acquire() void SalYieldMutex::acquire()
{ {
SolarMutexObject::acquire(); m_mutex.acquire();
mnThreadId = osl::Thread::getCurrentIdentifier(); mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++; mnCount++;
} }
@ -60,12 +60,12 @@ void SalYieldMutex::release()
mnThreadId = 0; mnThreadId = 0;
mnCount--; mnCount--;
} }
SolarMutexObject::release(); m_mutex.release();
} }
bool SalYieldMutex::tryToAcquire() bool SalYieldMutex::tryToAcquire()
{ {
if ( SolarMutexObject::tryToAcquire() ) if ( m_mutex.tryToAcquire() )
{ {
mnThreadId = osl::Thread::getCurrentIdentifier(); mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++; mnCount++;

View File

@ -42,7 +42,6 @@
#include <svdata.hxx> #include <svdata.hxx>
#include <generic/gendata.hxx> #include <generic/gendata.hxx>
#include <basebmp/scanlineformats.hxx> #include <basebmp/scanlineformats.hxx>
#include <vcl/solarmutex.hxx>
// FIXME: remove when we re-work the svp mainloop // FIXME: remove when we re-work the svp mainloop
#include <unx/salunxtime.h> #include <unx/salunxtime.h>

View File

@ -20,10 +20,10 @@
#ifndef INCLUDED_VCL_INC_GENERIC_GENINST_H #ifndef INCLUDED_VCL_INC_GENERIC_GENINST_H
#define INCLUDED_VCL_INC_GENERIC_GENINST_H #define INCLUDED_VCL_INC_GENERIC_GENINST_H
#include <comphelper/solarmutex.hxx>
#include <tools/solar.h> #include <tools/solar.h>
#include <osl/thread.hxx> #include <osl/thread.hxx>
#include <vclpluginapi.h> #include <vclpluginapi.h>
#include <vcl/solarmutex.hxx>
#include <salinst.hxx> #include <salinst.hxx>
#include <saldatabasic.hxx> #include <saldatabasic.hxx>
#include <generic/genprn.h> #include <generic/genprn.h>
@ -46,8 +46,10 @@ inline SalYieldMutexReleaser::~SalYieldMutexReleaser()
GetSalData()->m_pInstance->AcquireYieldMutex( m_nYieldCount ); GetSalData()->m_pInstance->AcquireYieldMutex( m_nYieldCount );
} }
class VCL_DLLPUBLIC SalYieldMutex : public vcl::SolarMutexObject class VCL_DLLPUBLIC SalYieldMutex : public comphelper::SolarMutex
{ {
osl::Mutex m_mutex;
protected: protected:
sal_uIntPtr mnCount; sal_uIntPtr mnCount;
oslThreadIdentifier mnThreadId; oslThreadIdentifier mnThreadId;
@ -60,7 +62,7 @@ public:
virtual void release(); virtual void release();
virtual bool tryToAcquire(); virtual bool tryToAcquire();
virtual sal_uIntPtr GetAcquireCount() const { return mnCount; } sal_uIntPtr GetAcquireCount() const { return mnCount; }
oslThreadIdentifier GetThreadId() const { return mnThreadId; } oslThreadIdentifier GetThreadId() const { return mnThreadId; }
}; };

View File

@ -20,8 +20,6 @@
#ifndef INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX #ifndef INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
#define INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX #define INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
#include <vcl/solarmutex.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <osl/thread.hxx> #include <osl/thread.hxx>
#include <salinst.hxx> #include <salinst.hxx>

View File

@ -23,7 +23,6 @@
#include "comphelper/solarmutex.hxx" #include "comphelper/solarmutex.hxx"
#include "osl/thread.hxx" #include "osl/thread.hxx"
#include "osl/conditn.h" #include "osl/conditn.h"
#include <vcl/solarmutex.hxx>
#ifdef MACOSX #ifdef MACOSX
#include "osx/osxvcltypes.h" #include "osx/osxvcltypes.h"
@ -37,8 +36,9 @@ class AquaSalFrame;
class ApplicationEvent; class ApplicationEvent;
class Image; class Image;
class SalYieldMutex : public vcl::SolarMutexObject class SalYieldMutex : public comphelper::SolarMutex
{ {
osl::Mutex m_mutex;
sal_uLong mnCount; sal_uLong mnCount;
oslThreadIdentifier mnThreadId; oslThreadIdentifier mnThreadId;

View File

@ -23,7 +23,6 @@
#include <osl/thread.hxx> #include <osl/thread.hxx>
#include <vclpluginapi.h> #include <vclpluginapi.h>
#include <salinst.hxx> #include <salinst.hxx>
#include <vcl/solarmutex.hxx>
#include "generic/geninst.h" #include "generic/geninst.h"
#include <prex.h> #include <prex.h>

View File

@ -30,7 +30,6 @@
#include "vcl/svapp.hxx" #include "vcl/svapp.hxx"
#include "vcl/window.hxx" #include "vcl/window.hxx"
#include "vcl/timer.hxx" #include "vcl/timer.hxx"
#include "vcl/solarmutex.hxx"
#include "osx/saldata.hxx" #include "osx/saldata.hxx"
#include "osx/salinst.h" #include "osx/salinst.h"
@ -278,7 +277,7 @@ SalYieldMutex::SalYieldMutex()
void SalYieldMutex::acquire() void SalYieldMutex::acquire()
{ {
SolarMutexObject::acquire(); m_mutex.acquire();
mnThreadId = osl::Thread::getCurrentIdentifier(); mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++; mnCount++;
} }
@ -291,12 +290,12 @@ void SalYieldMutex::release()
mnThreadId = 0; mnThreadId = 0;
mnCount--; mnCount--;
} }
SolarMutexObject::release(); m_mutex.release();
} }
bool SalYieldMutex::tryToAcquire() bool SalYieldMutex::tryToAcquire()
{ {
if ( SolarMutexObject::tryToAcquire() ) if ( m_mutex.tryToAcquire() )
{ {
mnThreadId = osl::Thread::getCurrentIdentifier(); mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++; mnCount++;

View File

@ -1,48 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <vcl/solarmutex.hxx>
using namespace vcl;
SolarMutexObject::SolarMutexObject() : m_solarMutex( osl_createMutex() )
{
}
SolarMutexObject::~SolarMutexObject()
{
osl_destroyMutex( m_solarMutex );
}
void SolarMutexObject::acquire()
{
osl_acquireMutex( m_solarMutex );
}
bool SolarMutexObject::tryToAcquire()
{
return osl_tryToAcquireMutex( m_solarMutex );
}
void SolarMutexObject::release()
{
osl_releaseMutex( m_solarMutex );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -30,7 +30,6 @@
#include <vcl/timer.hxx> #include <vcl/timer.hxx>
#include <vcl/apptypes.hxx> #include <vcl/apptypes.hxx>
#include <vcl/solarmutex.hxx>
#include <win/wincomp.hxx> #include <win/wincomp.hxx>
#include <win/salids.hrc> #include <win/salids.hrc>
#include <win/saldata.hxx> #include <win/saldata.hxx>
@ -110,8 +109,10 @@ LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPa
class SalYieldMutex : public vcl::SolarMutexObject class SalYieldMutex : public comphelper::SolarMutex
{ {
osl::Mutex m_mutex;
public: // for ImplSalYield() public: // for ImplSalYield()
WinSalInstance* mpInstData; WinSalInstance* mpInstData;
sal_uLong mnCount; sal_uLong mnCount;
@ -140,7 +141,7 @@ SalYieldMutex::SalYieldMutex( WinSalInstance* pInstData )
void SalYieldMutex::acquire() void SalYieldMutex::acquire()
{ {
SolarMutexObject::acquire(); m_mutex.acquire();
mnCount++; mnCount++;
mnThreadId = GetCurrentThreadId(); mnThreadId = GetCurrentThreadId();
} }
@ -151,7 +152,7 @@ void SalYieldMutex::release()
{ {
DWORD nThreadId = GetCurrentThreadId(); DWORD nThreadId = GetCurrentThreadId();
if ( mnThreadId != nThreadId ) if ( mnThreadId != nThreadId )
SolarMutexObject::release(); m_mutex.release();
else else
{ {
SalData* pSalData = GetSalData(); SalData* pSalData = GetSalData();
@ -168,13 +169,13 @@ void SalYieldMutex::release()
ImplPostMessage( mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 ); ImplPostMessage( mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 );
mnThreadId = 0; mnThreadId = 0;
mnCount--; mnCount--;
SolarMutexObject::release(); m_mutex.release();
mpInstData->mpSalWaitMutex->release(); mpInstData->mpSalWaitMutex->release();
} }
else else
{ {
mnCount--; mnCount--;
SolarMutexObject::release(); m_mutex.release();
} }
} }
else else
@ -182,7 +183,7 @@ void SalYieldMutex::release()
if ( mnCount == 1 ) if ( mnCount == 1 )
mnThreadId = 0; mnThreadId = 0;
mnCount--; mnCount--;
SolarMutexObject::release(); m_mutex.release();
} }
} }
} }
@ -191,7 +192,7 @@ void SalYieldMutex::release()
bool SalYieldMutex::tryToAcquire() bool SalYieldMutex::tryToAcquire()
{ {
if( SolarMutexObject::tryToAcquire() ) if( m_mutex.tryToAcquire() )
{ {
mnCount++; mnCount++;
mnThreadId = GetCurrentThreadId(); mnThreadId = GetCurrentThreadId();