summaryrefslogtreecommitdiff
authorStephan Bergmann <sbergman@redhat.com>2013-04-16 13:34:41 (GMT)
committer Stephan Bergmann <sbergman@redhat.com>2013-04-16 15:52:37 (GMT)
commit1268326e814837e111eaf320f72661f288393839 (patch) (side-by-side diff)
tree5518044c0fc0c952ae365560c287e7b3d5162929
parentb98617b3c86863fe5b4e3d9a96519707ae8cf58c (diff)
downloadcore-1268326e814837e111eaf320f72661f288393839.zip
core-1268326e814837e111eaf320f72661f288393839.tar.gz
Further clean-up related to removed library unloading feature
Change-Id: I1ec2aa4d0ed0940e7c0a26a18c78f2df4693d278
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cppuhelper/inc/cppuhelper/factory.hxx12
-rw-r--r--cppuhelper/inc/cppuhelper/implementationentry.hxx7
-rw-r--r--cppuhelper/source/factory.cxx57
-rw-r--r--sal/inc/rtl/unload.h66
-rw-r--r--sal/osl/all/compat.cxx25
-rw-r--r--sal/rtl/unload.cxx76
-rw-r--r--udkapi/com/sun/star/uno/XUnloadingPreference.idl26
7 files changed, 65 insertions, 204 deletions
diff --git a/cppuhelper/inc/cppuhelper/factory.hxx b/cppuhelper/inc/cppuhelper/factory.hxx
index 0c4f766..8dfda84 100644
--- a/cppuhelper/inc/cppuhelper/factory.hxx
+++ b/cppuhelper/inc/cppuhelper/factory.hxx
@@ -133,7 +133,8 @@ typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(
@param fptr function pointer for instanciating the object
@param rImplementationName implementation name of service
@param rServiceNames supported services
- @param pModCount for future extension (library unloading concept).
+ @param pModCount a backwards-compatibility remainder of a removed library
+ unloading feature; always set to null
*/
CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory >
SAL_CALL createSingleComponentFactory(
@@ -148,7 +149,8 @@ SAL_CALL createSingleComponentFactory(
@param fptr function pointer for instanciating the object
@param rImplementationName implementation name of service
@param rServiceNames supported services
- @param pModCount for future extension (library unloading concept).
+ @param pModCount a backwards-compatibility remainder of a removed library
+ unloading feature; always set to null
@see createSingleComponentFactory
*/
@@ -175,7 +177,8 @@ typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(SA
@param rImplementationName the implementation name. An empty string is possible.
@param pCreateFunction the function pointer to create an object.
@param rServiceNames the service supported by the implementation.
- @param pModCount for future extension (library unloading concept).
+ @param pModCount a backwards-compatibility remainder of a removed library
+ unloading feature; always set to null.
@return a factory that support the interfaces XServiceProvider, XServiceInfo
XSingleServiceFactory and XComponent.
@@ -217,7 +220,8 @@ createFactoryProxy(
@param rComponentName the implementation name. An empty string is possible.
@param pCreateFunction the function pointer to create an object.
@param rServiceNames the service supported by the implementation.
- @param pModCount for future extension (library unloading concept).
+ @param pModCount a backwards-compatibility remainder of a removed library
+ unloading feature; always set to null.
@return a factory that support the interfaces XServiceProvider, XServiceInfo
XSingleServiceFactory and XComponent.
diff --git a/cppuhelper/inc/cppuhelper/implementationentry.hxx b/cppuhelper/inc/cppuhelper/implementationentry.hxx
index f8d8f93..298c0dc 100644
--- a/cppuhelper/inc/cppuhelper/implementationentry.hxx
+++ b/cppuhelper/inc/cppuhelper/implementationentry.hxx
@@ -54,6 +54,9 @@ struct ImplementationEntry
com::sun::star::uno::Sequence< rtl::OUString > MY_FN_PTR( getSupportedServiceNames ) ();
/** Function that creates a SingleComponentFactory.
+
+ The pModCount parameter is a backwards-compatibility remainder of a
+ removed library unloading feature; always set to null.
*/
::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory >
MY_FN_PTR( createFactory )(
@@ -62,8 +65,8 @@ struct ImplementationEntry
::com::sun::star::uno::Sequence< ::rtl::OUString > const & rServiceNames,
rtl_ModuleCount * pModCount );
- /** The shared-library module-counter of the implementation. Maybe 0. The module-counter
- is used during by the createFactory()-function.
+ /** Backwards-compatibility remainder of a removed library unloading
+ feature; always set to null.
*/
rtl_ModuleCount * moduleCounter;
diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx
index dc5cf91..160a17a 100644
--- a/cppuhelper/source/factory.cxx
+++ b/cppuhelper/source/factory.cxx
@@ -280,49 +280,9 @@ public:
: OComponentHelper( aMutex )
, OSingleFactoryHelper( rServiceManager, rImplementationName_, pCreateFunction_, fptr, pServiceNames_ )
, bOneInstance( bOneInstance_ )
- , pModuleCount(0)
{
}
- // Used by the createXXXFactory functions. The argument pModCount is used to prevent the unloading of the module
- // which contains pCreateFunction_
- OFactoryComponentHelper(
- const Reference<XMultiServiceFactory > & rServiceManager,
- const OUString & rImplementationName_,
- ComponentInstantiation pCreateFunction_,
- ComponentFactoryFunc fptr,
- const Sequence< OUString > * pServiceNames_,
- rtl_ModuleCount * pModCount,
- sal_Bool bOneInstance_ = sal_False )
- SAL_THROW(())
- : OComponentHelper( aMutex )
- , OSingleFactoryHelper( rServiceManager, rImplementationName_, pCreateFunction_, fptr, pServiceNames_ )
- , bOneInstance( bOneInstance_ )
- , pModuleCount(pModCount)
- {
- if(pModuleCount)
- pModuleCount->acquire( pModuleCount);
- }
-
- // old function, only for backward compatibility
- OFactoryComponentHelper(
- const Reference<XMultiServiceFactory > & rServiceManager,
- const OUString & rImplementationName_,
- sal_Bool bOneInstance_ = sal_False )
- SAL_THROW(())
- : OComponentHelper( aMutex )
- , OSingleFactoryHelper( rServiceManager, rImplementationName_ )
- , bOneInstance( bOneInstance_ )
- , pModuleCount(0)
- {
- }
-
- ~OFactoryComponentHelper()
- {
- if(pModuleCount)
- pModuleCount->release( pModuleCount);
- }
-
// XInterface
Any SAL_CALL queryInterface( const Type & rType )
throw(::com::sun::star::uno::RuntimeException);
@@ -363,7 +323,6 @@ public:
private:
Reference<XInterface > xTheInstance;
sal_Bool bOneInstance;
- rtl_ModuleCount * pModuleCount;
protected:
// needed for implementing XUnloadingPreference in inheriting classes
sal_Bool isOneInstance() {return bOneInstance;}
@@ -1024,11 +983,11 @@ Reference<XSingleServiceFactory > SAL_CALL createSingleFactory(
const OUString & rImplementationName,
ComponentInstantiation pCreateFunction,
const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount *pModCount )
+ rtl_ModuleCount * )
SAL_THROW(())
{
return new OFactoryComponentHelper(
- rServiceManager, rImplementationName, pCreateFunction, 0, &rServiceNames, pModCount, sal_False );
+ rServiceManager, rImplementationName, pCreateFunction, 0, &rServiceNames, sal_False );
}
// global function
@@ -1046,11 +1005,11 @@ Reference<XSingleServiceFactory > SAL_CALL createOneInstanceFactory(
const OUString & rImplementationName,
ComponentInstantiation pCreateFunction,
const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount *pModCount )
+ rtl_ModuleCount * )
SAL_THROW(())
{
return new OFactoryComponentHelper(
- rServiceManager, rImplementationName, pCreateFunction, 0, &rServiceNames, pModCount, sal_True );
+ rServiceManager, rImplementationName, pCreateFunction, 0, &rServiceNames, sal_True );
}
// global function
@@ -1080,22 +1039,22 @@ Reference< lang::XSingleComponentFactory > SAL_CALL createSingleComponentFactory
ComponentFactoryFunc fptr,
OUString const & rImplementationName,
Sequence< OUString > const & rServiceNames,
- rtl_ModuleCount * pModCount)
+ rtl_ModuleCount *)
SAL_THROW(())
{
return new OFactoryComponentHelper(
- Reference< XMultiServiceFactory >(), rImplementationName, 0, fptr, &rServiceNames, pModCount, sal_False );
+ Reference< XMultiServiceFactory >(), rImplementationName, 0, fptr, &rServiceNames, sal_False );
}
Reference< lang::XSingleComponentFactory > SAL_CALL createOneInstanceComponentFactory(
ComponentFactoryFunc fptr,
OUString const & rImplementationName,
Sequence< OUString > const & rServiceNames,
- rtl_ModuleCount * pModCount)
+ rtl_ModuleCount *)
SAL_THROW(())
{
return new OFactoryComponentHelper(
- Reference< XMultiServiceFactory >(), rImplementationName, 0, fptr, &rServiceNames, pModCount, sal_True );
+ Reference< XMultiServiceFactory >(), rImplementationName, 0, fptr, &rServiceNames, sal_True );
}
}
diff --git a/sal/inc/rtl/unload.h b/sal/inc/rtl/unload.h
index 0bbc414..118b5cc 100644
--- a/sal/inc/rtl/unload.h
+++ b/sal/inc/rtl/unload.h
@@ -22,46 +22,22 @@
#include "sal/config.h"
#include "osl/interlck.h"
-#include "osl/module.h"
#include "osl/time.h"
#include "sal/saldllapi.h"
#include "sal/types.h"
-/** C-interface for a module reference counting
- */
+/** @file
+ Backwards-compatibility remainders of a removed library unloading feature.
+*/
+
#ifdef __cplusplus
extern "C"
{
#endif
-/**
-Pointers to <code>rtl_ModuleCount</code> are passed as arguments to the default factory creator
-functions: <code>createSingleComponentFactory</code>, <code>createSingleFactory</code>,
-<code>createOneInstanceFactory</code>.
-The factory implementation is calling <code>rtl_ModuleCount.acquire</code> when it is being
-constructed and it is calling <code>rtl_ModuleCount.release</code>. The implementations of
-<code>acquire</code>
-and <code>release</code> should influence the return value of <code>component_canUnload</code>
-in a way that it
-returns <code>sal_False</code> after <code>acquire</code> has been called. That is the module will not be unloaded
-once a default factory has been created. A call to <code>release</code> may cause
-<code>component_canUnload</code> to return <code>sal_False</code>, but only if there are
-no object alive which
-originated from the module. These objects are factory instances and the service instances
-which have been created by these factories.
-<p>
-It is not necessary to synchronize <code>acquire</code> and <code>release</code> as a whole.
-Simply sychronize the
-access to a counter variable, e.g. the <code>rtl_moduleCount_release</code> implementation:
-<pre>
-extern "C" void rtl_moduleCount_acquire(rtl_ModuleCount * that )
-{
- rtl_StandardModuleCount* pMod= (rtl_StandardModuleCount*)that;
- osl_atomic_increment( &pMod->counter);
-}
-</pre>
-The SAL library offers functions that can be used for <code>acquire</code> and <code>release</code>. See struct
-<code>_rtl_StandardModuleCount</code>.
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
*/
typedef struct _rtl_ModuleCount
{
@@ -69,16 +45,16 @@ typedef struct _rtl_ModuleCount
void ( SAL_CALL * release ) ( struct _rtl_ModuleCount * that );
}rtl_ModuleCount;
+/** Backwards-compatibility remainder of a removed library unloading feature.
+ @deprecated Do not use.
+*/
#define MODULE_COUNT_INIT \
{ {rtl_moduleCount_acquire,rtl_moduleCount_release}, rtl_moduleCount_canUnload, 0, {0, 0}}
-/**
-This struct can be used to implement the unloading mechanism. To make a UNO library
-unloadable create one global instance of this struct in the module. To initialize it one
-uses the MODULE_COUNT_INIT macro.
+/** Backwards-compatibility remainder of a removed library unloading feature.
-<pre>rtl_StandardModuleCount globalModuleCount= MODULE_COUNT_INIT</pre>;
+ @deprecated Do not use.
*/
typedef struct _rtl_StandardModuleCount
{
@@ -88,22 +64,24 @@ typedef struct _rtl_StandardModuleCount
TimeValue unusedSince;
} rtl_StandardModuleCount;
-/** Default implementation for <code>rtl_ModuleCount.acquire</code>. Use this function along with
-<code>rtl_StandardModuleCount</code>.
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
*/
SAL_DLLPUBLIC void rtl_moduleCount_acquire(rtl_ModuleCount * that );
-/** Default implementation for <code>rtl_ModuleCount.release</code>.
-Use this function along with
-<code>rtl_StandardModuleCount</code>.
+
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
*/
SAL_DLLPUBLIC void rtl_moduleCount_release( rtl_ModuleCount * that );
-/** Default implementation for <code>component_canUnload</code>. Use this function along with
-<code>rtl_StandardModuleCount</code>.
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
*/
SAL_DLLPUBLIC sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, TimeValue* libUnused);
-
#ifdef __cplusplus
}
#endif
diff --git a/sal/osl/all/compat.cxx b/sal/osl/all/compat.cxx
index 12f0da1..2f86771 100644
--- a/sal/osl/all/compat.cxx
+++ b/sal/osl/all/compat.cxx
@@ -39,6 +39,12 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL osl_tryToAcquireSemaphore(void *) {
for (;;) { std::abort(); } // avoid "must return a value" warnings
}
+SAL_DLLPUBLIC_EXPORT sal_Int32 SAL_CALL rtl_addUnloadingListener(
+ void (SAL_CALL *)(void *), void *)
+{
+ for (;;) { std::abort(); } // avoid "must return a value" warnings
+}
+
SAL_DLLPUBLIC_EXPORT sal_Int32 SAL_CALL rtl_compareMemory(
void const *, void const *, sal_Size)
{
@@ -67,33 +73,24 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_moveMemory(
std::abort();
}
-SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_zeroMemory(void *, sal_Size) {
- std::abort();
-}
-
SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL rtl_registerModuleForUnloading(oslModule)
{
for (;;) { std::abort(); } // avoid "must return a value" warnings
}
-SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_unregisterModuleForUnloading(oslModule)
-{
+SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_removeUnloadingListener(sal_Int32) {
std::abort();
}
-SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_unloadUnusedModules(TimeValue *)
-{
+SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_unloadUnusedModules(TimeValue *) {
std::abort();
}
-typedef void (SAL_CALL *rtl_unloadingListenerFunc)(void *id);
-SAL_DLLPUBLIC_EXPORT sal_Int32 SAL_CALL rtl_addUnloadingListener(rtl_unloadingListenerFunc, void *)
-{
- for (;;) { std::abort(); } // avoid "must return a value" warnings
+SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_unregisterModuleForUnloading(oslModule) {
+ std::abort();
}
-SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_removeUnloadingListener(sal_Int32)
-{
+SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_zeroMemory(void *, sal_Size) {
std::abort();
}
diff --git a/sal/rtl/unload.cxx b/sal/rtl/unload.cxx
index dd8ee23..0b5bc2e 100644
--- a/sal/rtl/unload.cxx
+++ b/sal/rtl/unload.cxx
@@ -17,79 +17,19 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <rtl/unload.h>
+#include "sal/config.h"
-#include <rtl/ustring.hxx>
-#include <rtl/instance.hxx>
-#include <osl/mutex.hxx>
+#include "osl/time.h"
+#include "rtl/unload.h"
-using osl::MutexGuard;
+extern "C" void rtl_moduleCount_acquire(rtl_ModuleCount *) {}
-//----------------------------------------------------------------------------
+extern "C" void rtl_moduleCount_release(rtl_ModuleCount *) {}
-#ifndef DISABLE_DYNLOADING
-
-namespace
-{
- class theUnloadingMutex : public rtl::Static<osl::Mutex, theUnloadingMutex>{};
-}
-
-static osl::Mutex& getUnloadingMutex()
-{
- return theUnloadingMutex::get();
-}
-
-#endif
-
-extern "C" void rtl_moduleCount_acquire(rtl_ModuleCount * that )
-{
-#ifdef DISABLE_DYNLOADING
- (void) that;
-#else
- rtl_StandardModuleCount* pMod= (rtl_StandardModuleCount*)that;
- osl_atomic_increment( &pMod->counter);
-#endif
-}
-
-extern "C" void rtl_moduleCount_release( rtl_ModuleCount * that )
-{
-#ifdef DISABLE_DYNLOADING
- (void) that;
-#else
- rtl_StandardModuleCount* pMod= (rtl_StandardModuleCount*)that;
- OSL_ENSURE( pMod->counter >0 , "library counter incorrect" );
- osl_atomic_decrement( &pMod->counter);
- if( pMod->counter == 0)
- {
- MutexGuard guard( getUnloadingMutex());
-
- if( sal_False == osl_getSystemTime( &pMod->unusedSince) )
- {
- // set the time to 0 if we could not get the time
- pMod->unusedSince.Seconds= 0;
- pMod->unusedSince.Nanosec= 0;
- }
- }
-#endif
-}
-
-extern "C" sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, TimeValue * libUnused)
+extern "C" sal_Bool rtl_moduleCount_canUnload(
+ rtl_StandardModuleCount *, TimeValue *)
{
-#ifdef DISABLE_DYNLOADING
- (void) that;
- (void) libUnused;
- return sal_False;
-#else
- if (that->counter == 0)
- {
- MutexGuard guard( getUnloadingMutex());
- if (libUnused && (that->counter == 0))
- {
- memcpy(libUnused, &that->unusedSince, sizeof(TimeValue));
- }
- }
- return (that->counter == 0);
-#endif
+ return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/udkapi/com/sun/star/uno/XUnloadingPreference.idl b/udkapi/com/sun/star/uno/XUnloadingPreference.idl
index 25c99e0..28dbea1 100644
--- a/udkapi/com/sun/star/uno/XUnloadingPreference.idl
+++ b/udkapi/com/sun/star/uno/XUnloadingPreference.idl
@@ -24,32 +24,12 @@
module com { module sun { module star { module uno {
-/** Components can implement <code>XUnloadingPreference</code> in order to indicate
- how they should be treated when their hosting library is to be unloaded.
-
- When someone calls <code>rtl_unloadUnusedModules</code> then the unloading
- listeners are notified by calling previously registered callback
- functions. A listener is an entity that employs, registers, and
- unregisters the callback functions on its behalf. Upon notification
- (the callback function is being called)
- a listener may release references to UNO components. Thus, the
- loaded libraries can be unloaded, if no one else keeps any
- objects from the library alive. <br>
- Before a listener releases references, it should ask for this interface.
- If the interface is not implemented, then the listener may release the
- object; otherwise, it calls <code>releaseOnNotification</code>. If the function
- returns false then the listener should keep the reference, otherwise
- it may release it.
+/** Backwards-compatibility remainder of a removed library unloading feature.
+
+ @deprecated Do not use.
*/
published interface XUnloadingPreference: com::sun::star::uno::XInterface
{
- /**
- The return value determines if the object wants to stay
- alive in case of an unloading procedure.
- @return
- <FALSE/>do not release references to this object,otherwise
- <TRUE/>
- */
boolean releaseOnNotification();
};