[Libreoffice-commits] core.git: 5 commits - cppuhelper/inc cppuhelper/source cppu/source sal/inc sal/osl sal/rtl stoc/source udkapi/com

Stephan Bergmann sbergman at redhat.com
Tue Apr 16 08:53:03 PDT 2013


 cppu/source/uno/lbenv.cxx                         |    3 
 cppu/source/uno/lbmap.cxx                         |    2 
 cppuhelper/inc/cppuhelper/factory.hxx             |   12 
 cppuhelper/inc/cppuhelper/implementationentry.hxx |    7 
 cppuhelper/source/factory.cxx                     |   57 --
 cppuhelper/source/shlib.cxx                       |    3 
 sal/inc/rtl/unload.h                              |  255 ------------
 sal/osl/all/compat.cxx                            |   25 +
 sal/rtl/unload.cxx                                |  438 ----------------------
 stoc/source/servicemanager/servicemanager.cxx     |  130 ------
 udkapi/com/sun/star/uno/XUnloadingPreference.idl  |   26 -
 11 files changed, 76 insertions(+), 882 deletions(-)

New commits:
commit 1268326e814837e111eaf320f72661f288393839
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Apr 16 15:34:41 2013 +0200

    Further clean-up related to removed library unloading feature
    
    Change-Id: I1ec2aa4d0ed0940e7c0a26a18c78f2df4693d278

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();
 };
 
commit b98617b3c86863fe5b4e3d9a96519707ae8cf58c
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Wed Apr 10 18:20:06 2013 +0200

    API CHANGE: remove some of useless rtl/unload.h functionality
    
    Change-Id: If32923e35ef97f42d5203975362e5c76948ff327
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sal/inc/rtl/unload.h b/sal/inc/rtl/unload.h
index 9de17b4..0bbc414 100644
--- a/sal/inc/rtl/unload.h
+++ b/sal/inc/rtl/unload.h
@@ -27,79 +27,6 @@
 #include "sal/saldllapi.h"
 #include "sal/types.h"
 
-/** @file
-The API enables an effective way of unloading libraries in a centralized way.
-The mechanism ensures that used libraries are not unloaded. This prevents
-crashes if library code is being used after unloading the library.
-The unloading mechanism currently only works with libraries which contain
-UNO services. A library cannot be unloaded if one of the following conditions
-apply
-
-<ul>
-<li>An instance is still referenced </li>
-<li>A module has been loaded without registering it </li>
-<li>The service manager has created a one instance service </li>
-<li>A service instance has been added to an UNO context </li>
-</ul>
-
-<b>Notification Mechanism</b>
-The API provides a notification mechanism. Clients can use it to do clean up,
-such as releasing cached references, in order to allow modules to be unloaded.
-As long as someone holds a reference to an object whose housing module
-supports unloading the module cannot be unloaded.<p>
-
-Because of the inherent danger of crashing the application by using this API
-all instances which control threads should be registered listeners. On
-notification they have to ensure that their threads assume a safe state, that
-is, they run outside of modules which could be unloaded and do not jump
-back into module code as a result of a finished function call. In other words,
-there must not be an address of the module on the thread's stack.
-<p>
-Since current operating systems lack APIs in respect to controlling the
-position of threads within libraries, it would be a major effort to comply with
-that recommendation. The best and most efficient way of handling the unloading
-scenario is to let all threads, except for the main thread, die in case of a
-notification.
-<p>
-Use this API with great care because it might crash the application. See the
-respective documentation (Library Unloading) on the udk.openoffice.org web site.
-*/
-
-
-/**
-A library which supports unloading has to implement and export a function
-called <code>component_canUnload</code>. <p>
-If the function returns <code>sal_True</code> then the module can be safely unloaded.
-That is the case when there are no external references to code within the
-library. In case a module houses UNO components then the function must return
-<code>sal_False</code> after the first factory has been handed out. The function then
-continues to return <code>sal_False</code> as long as there is at least one object (factory
-or service instance)  which originated from the module.<p>
-
-Libraries which not only contain UNO components (or none at all) have to
-provide a means to control whether they can be unloaded or not, e.g. However,
-there is no concept yet. <p>
-
-The argument <code>pTime</code> is an optional out-parameter. If the return value is
-<code>sal_True</code> then <code>pTime</code> reflects a point in time since
-when the module could have
-been unloaded. Since that time the function would have continually returned
-<code>sal_True</code> up to the present. The value of <code>pTime</code> is
-important for the decision
-as to a module will be unloaded. When someone initiates the unloading of
-modules by calling <code>rtl_unloadUnusedModules</code> then the caller can specify a time
-span with the effect that only those modules are unloaded which are unused at
-least for that amount of time. If <code>component_canUnload</code> does not
-fill in <code>pTime</code>
-then the module is unloaded immediately.<p>
-
-<code>component_canUnload</code> is implicitly called by <code>rtl_unloadUnusedModules
-</code>. There is no need to call the function directly.
-*/
-#define COMPONENT_CANUNLOAD         "component_canUnload"
-typedef sal_Bool (SAL_CALL * component_canUnloadFunc)( TimeValue* pTime);
-
-
 /** C-interface for a module reference counting
  */
 #ifdef __cplusplus
@@ -108,130 +35,6 @@ extern "C"
 #endif
 
 /**
-By registering a module, one declares that a module supports the
-unloading mechanism. One registers a module by calling this function.<p>
-
-A module can only be unloaded from memory when it has been registered
-as many times as it has been loaded. The reason is that a library can
-be "loaded" several times by <code>osl_loadModule</code>
-within the same process. The
-function will then return the same module handle because the library will
-effectively only be loaded once. To remove the library from memory it is
-necessary to call <code>osl_unloadModule</code> as often as <code>
-osl_loadModule</code> was called. The
-function <code>rtl_unloadUnusedModules</code> calls <code>osl_unloadModule</code>
-for a module as many
-times as it was registered. If, for example, a module has been registered one
-time less then <code>osl_loadModule</code> has been called and the module can be unloaded
-then it needs a call to <code>rtl_unloadUnusedModules</code> and an explicit call to
-<code>osl_unloadModule</code> to remove the module from memory. <p>
-
-A module must be registered every time it has been loaded otherwise the
-unloading mechanism is not effective.<p>
-
-Before a module is registered, one has to make sure that the module is in a
-state that prevents it from being unloaded. In other words,
-<code>component_canUnload</code> must return <code>sal_False</code>. Assuming that
-<code>component_canUnload</code>
-returns <code>sal_True</code> and it is registered regardless, then a call to
-<code>rtl_unloadUnusedModules</code> causes the module to be unloaded. This unloading can
-be set off by a different thread and the thread which registered the module is
-"unaware" of this. Then when the first thread tries to obtain a factory or
-calls another function in the module, the application will crash, because the
-module has been unloaded before. Therefore one has to ensure that the module
-cannot be unloaded before it is registered. This is simply done by obtaining a
-factory from the module. As long as a factory or some other object, which has
-been created by the factory, is alive, the <code>component_canUnload</code> function will
-return <code>sal_False</code>.<p>
-Loading and registering have to be in this order:<br>
-<ul>
-<li>load a library (<code>osl_loadModule</code>)</li>
-<li>get the <code>component_getFactory</code> function and get a factory</li>
-<li>register the module (rtl_registerModuleForUnloading</li>
-</ul>
-Usually the service manager is used to obtain an instance of a service.
-The service manager registers all modules which support the unloading mechanism.
-When the service manager is used to get service instances than one does not
-have to bother about registering.
-
- at param module a module handle as is obtained by osl_loadModule
- at return sal_True - the module could be registered for unloading, sal_False otherwise
-*/
-SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_registerModuleForUnloading( oslModule module);
-
-/**
-The function revokes the registration of a module. By calling the function for
-a previously registered module one prevents the module from being unloaded by
-this unloading mechanism. However, in order to completely unregister the module
-it is necessary to call the function as often as the module has been registered.
-<p>
-<code>rtl_unloadUnusedModules</code> unregisters the modules which it unloads. Therefore
-there is no need to call this function unless one means to prevent the unloading of a module.
-
- at param module a module handle as is obtained by osl_loadModule
-*/
-SAL_DLLPUBLIC void SAL_CALL rtl_unregisterModuleForUnloading( oslModule module);
-/**
-This function sets off the unloading mechanism. At first it notifies the
-unloading listeners in order to give them a chance to do cleanup and get
-their threads in a safe state. Then all registered modules are asked if they
-can be unloaded. That is, the function calls component_canUnload on every
-registered module. If <code>sal_True</code> is returned then <code>osl_unloadModule</code>
-is called for the belonging module as often as it is registered.
-<p>
-A call to <code>osl_unloadModule</code> does not guarantee that the module is unloaded even
-if its <code>component_canUnload</code> function returns <code>sal_True</code>.
-<p>
-The optional in-parameter <code>libUnused</code> specifies a period of time which a library
-must be unused in order to qualify for being unloaded. By using this argument
-one can counter the multithreading problem as described further above. It is in
-the responsibility of the user of this function to provide a timespan big enough
-to ensure that all threads are out of modules (see <code>component_canUnload</code>).
-<p>
-The service managers which have been created by functions such as
-<code>createRegistryServiceFactory</code> (declared in cppuhelper/servicefactory.hxx) are
-registered listeners and release the references to factories on notification.
-
-
- at param libUnused span of time that a module must be unused to be unloaded. the
-argument is optional.
-*/
-SAL_DLLPUBLIC void SAL_CALL rtl_unloadUnusedModules( TimeValue* libUnused);
-
-/**
-rtl_addUnloadingListener takes an argument of this type.
-
- at param id - The value that has been passed as second argument to rtl_addUnloadingListener
-*/
-typedef void (SAL_CALL *rtl_unloadingListenerFunc)(void* id);
-/**
-The function registered an unloading listener. The callback argument is a
-function which is called  when the unloading procedure has been initiated by a call to
-<code>rtl_unloadUnusedLibraries</code>. The second argument is used to distinguish between different
-listener instances and may be <code>NULL</code>. It will be passed as argument when the callback
-function is being called. The return value identifies the registered listener and will
-be used for removing the listener later on. If the same listener is added more then
-once then every registration is treated as if made for a different listener. That is,
-a different cookie is returned and the callback function will be called as many times
-as it has been registered.
- at param callback - a function that is called to notify listeners.
- at param _this  - a value to distinguish different listener instances
- at return identifier which is used in rtl_removeUnloadingListener
-*/
-SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_addUnloadingListener( rtl_unloadingListenerFunc callback, void* _this);
-
-/**
-Listeners (the callback functions) must be unregistered before the listener code
-becomes invalid. That is, if a module contains listener code, namely callback
-functions of type <code>rtl_unloadingListenerFunc</code>, then those functions must not be
-registered when <code>component_canUnload</code> returns <code>sal_True</code>.
-
- at param cookie is an identifier as returned by <code>rtl_addUnloadingListener</code> function.
-*/
-SAL_DLLPUBLIC void SAL_CALL rtl_removeUnloadingListener( sal_Int32 cookie );
-
-
-/**
 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>.
diff --git a/sal/osl/all/compat.cxx b/sal/osl/all/compat.cxx
index f9c7129..12f0da1 100644
--- a/sal/osl/all/compat.cxx
+++ b/sal/osl/all/compat.cxx
@@ -11,6 +11,8 @@
 
 #include <cstdlib>
 
+#include "osl/module.h"
+#include "osl/time.h"
 #include "sal/types.h"
 
 // Stubs for removed functionality, to be killed when we bump sal SONAME
@@ -69,6 +71,32 @@ 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)
+{
+    std::abort();
+}
+
+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_removeUnloadingListener(sal_Int32)
+{
+    std::abort();
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/unload.cxx b/sal/rtl/unload.cxx
index 4d4a414..dd8ee23 100644
--- a/sal/rtl/unload.cxx
+++ b/sal/rtl/unload.cxx
@@ -17,19 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <string.h>
-
 #include <rtl/unload.h>
-#include <rtl/alloc.h>
+
 #include <rtl/ustring.hxx>
 #include <rtl/instance.hxx>
 #include <osl/mutex.hxx>
-#include <boost/unordered_map.hpp>
-#include "rtl/allocator.hxx"
-
-#include <functional>
-#include <list>
-#include <deque>
 
 using osl::MutexGuard;
 
@@ -37,72 +29,6 @@ using osl::MutexGuard;
 
 #ifndef DISABLE_DYNLOADING
 
-static void rtl_notifyUnloadingListeners();
-
-static sal_Bool isEqualTimeValue ( const TimeValue* time1,  const TimeValue* time2)
-{
-    if( time1->Seconds == time2->Seconds &&
-        time1->Nanosec == time2->Nanosec)
-        return sal_True;
-    else
-        return sal_False;
-}
-
-static sal_Bool isGreaterTimeValue(  const TimeValue* time1,  const TimeValue* time2)
-{
-    sal_Bool retval= sal_False;
-    if ( time1->Seconds > time2->Seconds)
-        retval= sal_True;
-    else if ( time1->Seconds == time2->Seconds)
-    {
-        if( time1->Nanosec > time2->Nanosec)
-            retval= sal_True;
-    }
-    return retval;
-}
-
-static sal_Bool isGreaterEqualTimeValue( const TimeValue* time1, const TimeValue* time2)
-{
-    if( isEqualTimeValue( time1, time2) )
-        return sal_True;
-    else if( isGreaterTimeValue( time1, time2))
-        return sal_True;
-    else
-        return sal_False;
-}
-
-static void addTimeValue( const TimeValue* value1, const TimeValue* value2, TimeValue* result)
-{
-    sal_uInt64 sum;
-    result->Nanosec=0;
-    result->Seconds=0;
-
-    sum= value1->Nanosec + value2->Nanosec;
-    if( sum >= 1000000000 )
-    {
-        result->Seconds=1;
-        sum -= 1000000000;
-    }
-    result->Nanosec= (sal_uInt32)sum;
-    result->Seconds += value1->Seconds + value2->Seconds;
-}
-
-
-static sal_Bool hasEnoughTimePassed( const TimeValue* unusedSince, const TimeValue* timespan)
-{
-    sal_Bool retval= sal_False;
-    TimeValue currentTime;
-    if( osl_getSystemTime( &currentTime))
-    {
-        TimeValue addedTime;
-        addTimeValue( unusedSince, timespan, &addedTime);
-        if( isGreaterEqualTimeValue( &currentTime, &addedTime))
-            retval= sal_True;
-    }
-
-    return retval;
-}
-
 namespace
 {
     class theUnloadingMutex : public rtl::Static<osl::Mutex, theUnloadingMutex>{};
@@ -147,43 +73,6 @@ extern "C" void rtl_moduleCount_release( rtl_ModuleCount * that )
 #endif
 }
 
-#ifndef DISABLE_DYNLOADING
-
-struct hashModule
-{
-    size_t operator()( const oslModule& rkey) const
-    {
-        return (size_t)rkey;
-    }
-};
-
-typedef boost::unordered_map<
-    oslModule,
-    std::pair<sal_uInt32, component_canUnloadFunc>,
-    hashModule,
-    std::equal_to<oslModule>,
-    rtl::Allocator<oslModule>
-> ModuleMap;
-
-typedef ModuleMap::iterator Mod_IT;
-
-static ModuleMap& getModuleMap()
-{
-    static ModuleMap * g_pMap= NULL;
-    if (!g_pMap)
-    {
-        MutexGuard guard( getUnloadingMutex() );
-        if (!g_pMap)
-        {
-            static ModuleMap g_aModuleMap;
-            g_pMap= &g_aModuleMap;
-        }
-    }
-    return *g_pMap;
-}
-
-#endif
-
 extern "C" sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, TimeValue * libUnused)
 {
 #ifdef DISABLE_DYNLOADING
@@ -203,255 +92,4 @@ extern "C" sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, T
 #endif
 }
 
-
-extern "C" sal_Bool SAL_CALL rtl_registerModuleForUnloading( oslModule module)
-{
-#ifdef DISABLE_DYNLOADING
-    (void) module;
-    return sal_False;
-#else
-    MutexGuard guard( getUnloadingMutex());
-    ModuleMap& moduleMap= getModuleMap();
-    sal_Bool ret= sal_True;
-
-    // If the module has been registered before, then find it and increment
-    // its reference cout
-    Mod_IT it= moduleMap.find( module);
-    if( it != moduleMap.end())
-    {
-        //module already registered, increment ref count
-        it->second.first++;
-    }
-    else
-    {
-        // Test if the module supports unloading (exports component_canUnload)
-        rtl::OUString name(RTL_CONSTASCII_USTRINGPARAM( COMPONENT_CANUNLOAD));
-        component_canUnloadFunc pFunc=
-            (component_canUnloadFunc)osl_getFunctionSymbol( module, name.pData);
-        if (pFunc)
-        {
-            //register module for the first time, set ref count to 1
-            moduleMap[module]= std::make_pair((sal_uInt32)1, pFunc);
-        }
-        else
-            ret= sal_False;
-    }
-    return ret;
-#endif
-}
-
-extern "C" void SAL_CALL rtl_unregisterModuleForUnloading( oslModule module)
-{
-#ifdef DISABLE_DYNLOADING
-    (void) module;
-#else
-    MutexGuard guard( getUnloadingMutex());
-
-    ModuleMap& moduleMap= getModuleMap();
-    Mod_IT it= moduleMap.find( module);
-    if( it != moduleMap.end() )
-    {
-        // The module is registered, decrement ref count.
-        it->second.first --;
-
-        // If the refcount == 0 then remove the module from the map
-        if( it->second.first == 0)
-            moduleMap.erase( it);
-    }
-#endif
-}
-
-extern "C" void SAL_CALL rtl_unloadUnusedModules( TimeValue* libUnused)
-{
-#ifdef DISABLE_DYNLOADING
-    (void) libUnused;
-#else
-    MutexGuard guard( getUnloadingMutex());
-
-    typedef std::list< oslModule, rtl::Allocator<oslModule> > list_type;
-    list_type unloadedModulesList;
-
-    ModuleMap& moduleMap= getModuleMap();
-    Mod_IT it_e= moduleMap.end();
-
-    // notify all listeners
-    rtl_notifyUnloadingListeners();
-
-    // prepare default TimeValue if argumetn is NULL
-    TimeValue nullTime={0,0};
-    TimeValue* pLibUnused= libUnused? libUnused : &nullTime;
-
-    Mod_IT it= moduleMap.begin();
-    for (; it != it_e; ++it)
-    {
-        //can the module be unloaded?
-        component_canUnloadFunc func= it->second.second;
-        TimeValue unusedSince= {0, 0};
-
-        if( func( &unusedSince) )
-        {
-            // module can be unloaded if it has not been used at least for the time
-            // specified by the argument libUnused
-            if( hasEnoughTimePassed( &unusedSince, pLibUnused))
-            {
-                // get the reference count and unload the module as many times
-                sal_uInt32 refCount= it->second.first;
-
-                for ( sal_uInt32 i=0; i < refCount; i++)
-                    osl_unloadModule( it->first);
-
-                // mark the module for later removal
-                unloadedModulesList.push_front( it->first);
-            }
-        }
-    }
-
-    // remove all entries containing invalid (unloaded) modules
-    list_type::const_iterator un_it= unloadedModulesList.begin();
-    for (; un_it != unloadedModulesList.end(); ++un_it)
-    {
-        moduleMap.erase( *un_it);
-    }
-#endif
-}
-
-#ifndef DISABLE_DYNLOADING
-
-// ==============================================================================
-// Unloading Listener Administration
-//===============================================================================
-struct hashListener
-{
-    size_t operator()( const sal_Int32& rkey) const
-    {
-        return (size_t)rkey;
-    }
-};
-
-typedef boost::unordered_map<
-    sal_Int32,
-    std::pair<rtl_unloadingListenerFunc, void*>,
-    hashListener,
-    std::equal_to<sal_Int32>,
-    rtl::Allocator<sal_Int32>
-> ListenerMap;
-
-typedef ListenerMap::iterator Lis_IT;
-
-static ListenerMap& getListenerMap()
-{
-    static ListenerMap * g_pListeners= NULL;
-    if (!g_pListeners)
-    {
-        MutexGuard guard( getUnloadingMutex() );
-        if (!g_pListeners)
-        {
-            static ListenerMap g_aListenerMap;
-            g_pListeners= &g_aListenerMap;
-        }
-    }
-    return *g_pListeners;
-}
-
-
-// This queue contains cookies which have been passed out by rtl_addUnloadingListener and
-// which have been regainded by rtl_removeUnloadingListener. When rtl_addUnloadingListener
-// is called then a cookie has to be returned. First we look into the set if there is one
-// available. Otherwise a new cookie will be provided.
-// not a new value is returned.
-
-typedef std::deque<
-    sal_Int32,
-    rtl::Allocator<sal_Int32>
-> queue_type;
-
-static queue_type& getCookieQueue()
-{
-    static queue_type * g_pCookies= NULL;
-    if (!g_pCookies)
-    {
-        MutexGuard guard( getUnloadingMutex() );
-        if (!g_pCookies)
-        {
-            static queue_type g_aCookieQueue;
-            g_pCookies= &g_aCookieQueue;
-        }
-    }
-    return *g_pCookies;
-}
-
-static sal_Int32 getCookie()
-{
-    static sal_Int32 cookieValue= 1;
-
-    sal_Int32 retval;
-    queue_type& regainedCookies= getCookieQueue();
-    if( regainedCookies.empty() )
-        retval= cookieValue++;
-    else
-    {
-        retval= regainedCookies.front();
-        regainedCookies.pop_front();
-    }
-    return retval;
-}
-
-static inline void recycleCookie( sal_Int32 i)
-{
-    getCookieQueue().push_back(i);
-}
-
-
-#endif
-
-// calling the function twice with the same arguments will return tow different cookies.
-// The listener will then notified twice.
-
-extern "C"
-sal_Int32 SAL_CALL rtl_addUnloadingListener( rtl_unloadingListenerFunc callback, void* _this)
-{
-#ifdef DISABLE_DYNLOADING
-    (void) callback;
-    (void) _this;
-    return 0;
-#else
-    MutexGuard guard( getUnloadingMutex());
-
-    sal_Int32 cookie= getCookie();
-    ListenerMap& listenerMap= getListenerMap();
-    listenerMap[ cookie]= std::make_pair( callback, _this);
-    return cookie;
-#endif
-}
-
-
-extern "C"
-void SAL_CALL rtl_removeUnloadingListener( sal_Int32 cookie )
-{
-#ifdef DISABLE_DYNLOADING
-    (void) cookie;
-#else
-    MutexGuard guard( getUnloadingMutex());
-
-    ListenerMap& listenerMap= getListenerMap();
-    size_t removedElements= listenerMap.erase( cookie);
-    if( removedElements )
-        recycleCookie( cookie);
-#endif
-}
-
-#ifndef DISABLE_DYNLOADING
-
-static void rtl_notifyUnloadingListeners()
-{
-    ListenerMap& listenerMap= getListenerMap();
-    for( Lis_IT it= listenerMap.begin(); it != listenerMap.end(); ++it)
-    {
-        rtl_unloadingListenerFunc callbackFunc= it->second.first;
-        callbackFunc( it->second.second);
-    }
-}
-
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 65be07720b04dbf8635cf7a5a52500238aefed59
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Wed Apr 10 18:01:08 2013 +0200

    do not use deprecated rtl_registerModuleForUnloading
    
    Change-Id: I59014906c8409fc7ac0f155c9562613c309b8b06
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 93b5bf1..bab6ffd 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -28,7 +28,6 @@
 #include "osl/module.h"
 #include "osl/process.h"
 #include "rtl/process.h"
-#include "rtl/unload.h"
 #include "rtl/string.hxx"
 #include "rtl/ustring.hxx"
 #include "rtl/ustrbuf.hxx"
@@ -1092,8 +1091,6 @@ static bool loadEnv(OUString const  & cLibStem,
 #endif
 
     (*fpInit)( pEnv ); // init of environment
-    ::rtl_registerModuleForUnloading( hMod );
-
     return true;
 }
 
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index 530a5c8..f699cee 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -24,7 +24,6 @@
 #include <set>
 #include <algorithm>
 
-#include "rtl/unload.h"
 #include "rtl/ustring.hxx"
 #include "rtl/ustrbuf.hxx"
 #include "osl/module.h"
@@ -443,7 +442,6 @@ static Mapping loadExternalMapping(
                 OSL_ASSERT( aExt.is() );
                 if (aExt.is())
                 {
-                    ::rtl_registerModuleForUnloading( hModule );
                     return aExt;
                 }
             }
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index 9a741d5..a0dcbd3 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -23,7 +23,6 @@
 #include "osl/file.hxx"
 #include "osl/mutex.hxx"
 #include "osl/module.hxx"
-#include "rtl/unload.h"
 #include "rtl/ustrbuf.hxx"
 #include "rtl/instance.hxx"
 #include "uno/environment.h"
@@ -620,8 +619,6 @@ Reference< XInterface > SAL_CALL loadSharedLibComponentFactory(
             aExcMsg,
             Reference< XInterface >() );
     }
-
-    rtl_registerModuleForUnloading( lib);
     return xRet;
 }
 
commit a1c07004a00a9cd13cf78d2300fe2d3ddf2672cf
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Apr 16 09:43:37 2013 +0200

    Unused include
    
    Change-Id: If1b2a289212efb0080b1a0945219163f1fcc7d14

diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 7ef7436..9c53da9 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -23,7 +23,6 @@
 
 #include <boost/unordered_map.hpp>
 #include <boost/unordered_set.hpp>
-#include <list>
 #include <uno/mapping.hxx>
 #include <uno/dispatcher.h>
 #include <cppuhelper/queryinterface.hxx>
commit fc6ce33504e09711a92b4a0e4d3260a4a5e498a9
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Wed Apr 10 18:17:41 2013 +0200

    stoc: do not use rtl/unload.h functionality
    
    Change-Id: I7bddfbabc6e7e3a672681962f82e64ff4082e8b5
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 93923c2..7ef7436 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -32,7 +32,6 @@
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/implementationentry.hxx>
-#include <rtl/unload.h>
 #include <cppuhelper/component_context.hxx>
 #include <cppuhelper/bootstrap.hxx>
 #include <cppuhelper/compbase6.hxx>
@@ -428,8 +427,6 @@ struct OServiceManagerMutex
     Mutex m_mutex;
 };
 
-extern "C" void SAL_CALL smgrUnloadingListener(void* id);
-
 typedef WeakComponentImplHelper7<
     lang::XMultiServiceFactory, lang::XMultiComponentFactory, lang::XServiceInfo,
     lang::XInitialization,
@@ -441,8 +438,6 @@ class OServiceManager
     , public t_OServiceManager_impl
 {
 public:
-    friend void SAL_CALL smgrUnloadingListener(void* id);
-
     OServiceManager( Reference< XComponentContext > const & xContext );
     virtual ~OServiceManager();
 
@@ -527,14 +522,8 @@ protected:
 
     Reference< beans::XPropertySetInfo > m_xPropertyInfo;
 
-    sal_Int32 m_nUnloadingListenerId;
-
-    // Does clean up when the unloading mechanism has been set off. It is called from
-    // the listener function smgrUnloadingListener.
-    void onUnloadingNotify();
     // factories which have been loaded and not inserted( by XSet::insert)
-    // are remembered by this set. Those factories
-    // are not released on a call to onUnloadingNotify
+    // are remembered by this set.
     HashSet_Ref m_SetLoadedFactories;
 private:
 
@@ -765,7 +754,6 @@ OServiceManager::OServiceManager( Reference< XComponentContext > const & xContex
     , m_bInDisposing( false )
 {
     g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
-    m_nUnloadingListenerId= rtl_addUnloadingListener( smgrUnloadingListener, this);
 }
 
 /**
@@ -773,108 +761,9 @@ OServiceManager::OServiceManager( Reference< XComponentContext > const & xContex
  */
 OServiceManager::~OServiceManager()
 {
-    if( m_nUnloadingListenerId != 0)
-        rtl_removeUnloadingListener( m_nUnloadingListenerId );
-
     g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
 }
 
-// Removes entries in m_ServiceMap, m_ImplementationNameMap and m_ImplementationNameMap
-// if those entries have not been inserted through XSet::insert. Therefore the entries
-// are compared with the entries in m_SetLoadedFactories.
-void OServiceManager::onUnloadingNotify()
-{
-    MutexGuard aGuard( m_mutex);
-
-    typedef HashSet_Ref::const_iterator CIT_S;
-    typedef HashMultimap_OWString_Interface::iterator IT_MM;
-
-    CIT_S it_SetEnd= m_SetLoadedFactories.end();
-    IT_MM it_end1= m_ServiceMap.end();
-    list<IT_MM> listDeleteServiceMap;
-    typedef list<IT_MM>::const_iterator CIT_DMM;
-    // find occurrences in m_ServiceMap
-    for(IT_MM it_i1= m_ServiceMap.begin(); it_i1 != it_end1; ++it_i1)
-    {
-        if( m_SetLoadedFactories.find( it_i1->second) != it_SetEnd)
-        {
-            Reference<XUnloadingPreference> xunl( it_i1->second, UNO_QUERY);
-            if( xunl.is())
-            {
-                if( xunl->releaseOnNotification())
-                    listDeleteServiceMap.push_front( it_i1);
-            }
-            else
-                listDeleteServiceMap.push_front( it_i1);
-        }
-    }
-    // delete elements from m_ServiceMap
-    CIT_DMM it_end2= listDeleteServiceMap.end();
-    for( CIT_DMM it_i2= listDeleteServiceMap.begin(); it_i2 != it_end2; ++it_i2)
-        m_ServiceMap.erase( *it_i2);
-
-    // find elements in m_ImplementationNameMap
-    typedef HashMap_OWString_Interface::iterator IT_M;
-    IT_M it_end3= m_ImplementationNameMap.end();
-    list<IT_M> listDeleteImplementationNameMap;
-    typedef list<IT_M>::const_iterator CIT_DM;
-    for( IT_M it_i3= m_ImplementationNameMap.begin();  it_i3 != it_end3; ++it_i3)
-    {
-        if( m_SetLoadedFactories.find( it_i3->second) != it_SetEnd)
-        {
-            Reference<XUnloadingPreference> xunl( it_i3->second, UNO_QUERY);
-            if( xunl.is())
-            {
-                if( xunl->releaseOnNotification())
-                    listDeleteImplementationNameMap.push_front( it_i3);
-            }
-            else
-                listDeleteImplementationNameMap.push_front( it_i3);
-        }
-    }
-    // delete elements from m_ImplementationNameMap
-    CIT_DM it_end4= listDeleteImplementationNameMap.end();
-    for( CIT_DM it_i4= listDeleteImplementationNameMap.begin(); it_i4 != it_end4; ++it_i4)
-        m_ImplementationNameMap.erase( *it_i4);
-
-    // find elements in m_ImplementationMap
-    typedef HashSet_Ref::iterator IT_S;
-    IT_S it_end5= m_ImplementationMap.end();
-    list<IT_S> listDeleteImplementationMap;
-    typedef list<IT_S>::const_iterator CIT_DS;
-    for( IT_S it_i5= m_ImplementationMap.begin(); it_i5 != it_end5; ++it_i5)
-    {
-        if( m_SetLoadedFactories.find( *it_i5) != it_SetEnd)
-        {
-            Reference<XUnloadingPreference> xunl( *it_i5, UNO_QUERY);
-            if( xunl.is())
-            {
-                if( xunl->releaseOnNotification())
-                    listDeleteImplementationMap.push_front( it_i5);
-            }
-            else
-                listDeleteImplementationMap.push_front( it_i5);
-        }
-    }
-    // delete elements from m_ImplementationMap
-    CIT_DS it_end6= listDeleteImplementationMap.end();
-    for( CIT_DS it_i6= listDeleteImplementationMap.begin(); it_i6 != it_end6; ++it_i6)
-        m_ImplementationMap.erase( *it_i6);
-
-    // remove Event listener before the factories are released.
-    IT_S it_end7= m_SetLoadedFactories.end();
-
-    Reference<XEventListener> xlistener= getFactoryListener();
-    for( IT_S it_i7= m_SetLoadedFactories.begin(); it_i7 != it_end7; ++it_i7)
-    {
-        Reference<XComponent> xcomp( *it_i7, UNO_QUERY);
-        if( xcomp.is())
-            xcomp->removeEventListener( xlistener);
-    }
-    // release the factories in m_SetLoadedFactories
-    m_SetLoadedFactories.clear();
-}
-
 // XComponent
 void OServiceManager::dispose()
     throw(::com::sun::star::uno::RuntimeException)
@@ -929,10 +818,6 @@ void OServiceManager::disposing()
 
     // not only the Event should hold the object
     OSL_ASSERT( m_refCount != 1 );
-
-    // Revoke this service manager as unloading listener
-    rtl_removeUnloadingListener( m_nUnloadingListenerId);
-    m_nUnloadingListenerId=0;
 }
 
 // XPropertySet
@@ -1855,18 +1740,6 @@ Any ORegistryServiceManager::getPropertyValue(const OUString& PropertyName)
     return OServiceManager::getPropertyValue( PropertyName );
 }
 
-/* This is the listener function used by the service manager in order
-to implement the unloading mechanism, id is the this pointer of the
-service manager instances. On notification, that is the function is being called
-by rtl_unloadUnusedModules, the cached factroies are being removed from the
-service manager ( except manually inserted factories).
-*/
-extern "C" void SAL_CALL smgrUnloadingListener(void* id)
-{
-    stoc_smgr::OServiceManager* pMgr= reinterpret_cast<stoc_smgr::OServiceManager*>( id);
-      pMgr->onUnloadingNotify();
-}
-
 } // namespace
 
 namespace stoc_bootstrap


More information about the Libreoffice-commits mailing list