[Libreoffice-commits] core.git: 2 commits - include/toolkit toolkit/source

Tor Lillqvist tml at collabora.com
Sat Apr 19 00:58:18 PDT 2014


 include/toolkit/helper/accessibilityclient.hxx |    9 --
 toolkit/source/helper/accessibilityclient.cxx  |  108 ++++++-------------------
 2 files changed, 29 insertions(+), 88 deletions(-)

New commits:
commit 6a579871d93c05630986f7d67bd670287ceba6de
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Apr 19 10:55:31 2014 +0300

    If it has been "not recommended currently" since 2007, it can go away
    
    Change-Id: If60f51d57e2a2e980307c7a11caa39988aaaa9b4

diff --git a/include/toolkit/helper/accessibilityclient.hxx b/include/toolkit/helper/accessibilityclient.hxx
index a3915af..26d6f56 100644
--- a/include/toolkit/helper/accessibilityclient.hxx
+++ b/include/toolkit/helper/accessibilityclient.hxx
@@ -22,14 +22,8 @@
 
 #include <toolkit/helper/accessiblefactory.hxx>
 
-
 namespace toolkit
 {
-
-
-
-    //= AccessibilityClient
-
     /** a client for the accessibility implementations which have been
         outsourced from the main toolkit library
 
@@ -49,7 +43,6 @@ namespace toolkit
 
     public:
         AccessibilityClient();
-        ~AccessibilityClient();
 
         IAccessibleFactory& getFactory();
 
@@ -57,10 +50,8 @@ namespace toolkit
         void ensureInitialized();
     };
 
-
 }   // namespace toolkit
 
-
 #endif // INCLUDED_TOOLKIT_HELPER_ACCESSIBILITYCLIENT_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/helper/accessibilityclient.cxx b/toolkit/source/helper/accessibilityclient.cxx
index 7364a5b..3db9a72 100644
--- a/toolkit/source/helper/accessibilityclient.cxx
+++ b/toolkit/source/helper/accessibilityclient.cxx
@@ -29,34 +29,13 @@
 #include <osl/diagnose.h>
 #include <tools/solar.h>
 
-// #define UNLOAD_ON_LAST_CLIENT_DYING
-    // this is not recommended currently. If enabled, the implementation will log
-    // the number of active clients, and unload the acc library when the last client
-    // goes away.
-    // Sounds like a good idea, unfortunately, there's no guarantee that all objects
-    // implemented in this library are already dead.
-    // Iow, just because an object implementing an XAccessible (implemented in this lib
-    // here) died, it's not said that everybody released all references to the
-    // XAccessibleContext used by this component, and implemented in the acc lib.
-    // So we cannot really unload the lib.
-
-    // Alternatively, if the lib would us own "usage counting", i.e. every component
-    // implemented therein would affect a static ref count, the acc lib could care
-    // for unloading itself.
-
-
 namespace toolkit
 {
-
-
     using namespace ::com::sun::star::uno;
     using namespace ::com::sun::star::accessibility;
 
     namespace
     {
-#ifdef UNLOAD_ON_LAST_CLIENT_DYING
-        static oslInterlockedCount                      s_nAccessibilityClients = 0;
-#endif // UNLOAD_ON_LAST_CLIENT_DYING
 #ifndef DISABLE_DYNLOADING
         static oslModule                                s_hAccessibleImplementationModule = NULL;
 #endif
@@ -201,81 +180,48 @@ namespace toolkit
 
         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
 
-#ifdef UNLOAD_ON_LAST_CLIENT_DYING
-        if ( 1 == osl_atomic_increment( &s_nAccessibilityClients ) )
-        {   // the first client
-#endif // UNLOAD_ON_LAST_CLIENT_DYING
-
 #if HAVE_FEATURE_DESKTOP
-            // load the library implementing the factory
-            if ( !s_pFactory.get() )
-            {
+        // load the library implementing the factory
+        if ( !s_pFactory.get() )
+        {
 #ifndef DISABLE_DYNLOADING
-                const OUString sModuleName( SVLIBRARY( "acc" ) );
-                s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
-                if ( s_hAccessibleImplementationModule != NULL )
-                {
-                    const OUString sFactoryCreationFunc =
-                        OUString("getStandardAccessibleFactory");
-                    s_pAccessibleFactoryFunc = (GetStandardAccComponentFactory)
-                        osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData );
+            const OUString sModuleName( SVLIBRARY( "acc" ) );
+            s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
+            if ( s_hAccessibleImplementationModule != NULL )
+            {
+                const OUString sFactoryCreationFunc =
+                    OUString("getStandardAccessibleFactory");
+                s_pAccessibleFactoryFunc = (GetStandardAccComponentFactory)
+                    osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData );
 
-                }
-                OSL_ENSURE( s_pAccessibleFactoryFunc, "AccessibilityClient::ensureInitialized: could not load the library, or not retrieve the needed symbol!" );
+            }
+            OSL_ENSURE( s_pAccessibleFactoryFunc, "AccessibilityClient::ensureInitialized: could not load the library, or not retrieve the needed symbol!" );
 #else
-                s_pAccessibleFactoryFunc = getStandardAccessibleFactory;
+            s_pAccessibleFactoryFunc = getStandardAccessibleFactory;
 #endif // DISABLE_DYNLOADING
 
-                // get a factory instance
-                if ( s_pAccessibleFactoryFunc )
+            // get a factory instance
+            if ( s_pAccessibleFactoryFunc )
+            {
+                IAccessibleFactory* pFactory = static_cast< IAccessibleFactory* >( (*s_pAccessibleFactoryFunc)() );
+                OSL_ENSURE( pFactory, "AccessibilityClient::ensureInitialized: no factory provided by the A11Y lib!" );
+                if ( pFactory )
                 {
-                    IAccessibleFactory* pFactory = static_cast< IAccessibleFactory* >( (*s_pAccessibleFactoryFunc)() );
-                    OSL_ENSURE( pFactory, "AccessibilityClient::ensureInitialized: no factory provided by the A11Y lib!" );
-                    if ( pFactory )
-                    {
-                        s_pFactory = pFactory;
-                        pFactory->release();
-                    }
+                    s_pFactory = pFactory;
+                    pFactory->release();
                 }
             }
+        }
 #endif // HAVE_FEATURE_DESKTOP
 
-            if ( !s_pFactory.get() )
-                // the attempt to load the lib, or to create the factory, failed
-                // -> fall back to a dummy factory
-                s_pFactory = new AccessibleDummyFactory;
-#ifdef UNLOAD_ON_LAST_CLIENT_DYING
-        }
-#endif
+        if ( !s_pFactory.get() )
+            // the attempt to load the lib, or to create the factory, failed
+            // -> fall back to a dummy factory
+            s_pFactory = new AccessibleDummyFactory;
 
         m_bInitialized = true;
     }
 
-
-    AccessibilityClient::~AccessibilityClient()
-    {
-        if ( m_bInitialized )
-        {
-            ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-
-#ifdef UNLOAD_ON_LAST_CLIENT_DYING
-            if( 0 == osl_atomic_decrement( &s_nAccessibilityClients ) )
-            {
-                s_pFactory = NULL;
-#if HAVE_FEATURE_DESKTOP
-                s_pAccessibleFactoryFunc = NULL;
-#endif
-                if ( s_hAccessibleImplementationModule )
-                {
-                    osl_unloadModule( s_hAccessibleImplementationModule );
-                    s_hAccessibleImplementationModule = NULL;
-                }
-            }
-#endif // UNLOAD_ON_LAST_CLIENT_DYING
-        }
-    }
-
-
     IAccessibleFactory& AccessibilityClient::getFactory()
     {
         ensureInitialized();
commit 652ef6e3131358e9d83dc45d2cbd90bf207a3aaf
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Apr 19 10:51:31 2014 +0300

    WaE: unused variable 's_pAccessibleFactoryFunc'
    
    Change-Id: I45f2dfcfedbcbd3aa1cbff965ce255ce9a413867

diff --git a/toolkit/source/helper/accessibilityclient.cxx b/toolkit/source/helper/accessibilityclient.cxx
index 4a02a50..7364a5b 100644
--- a/toolkit/source/helper/accessibilityclient.cxx
+++ b/toolkit/source/helper/accessibilityclient.cxx
@@ -60,7 +60,9 @@ namespace toolkit
 #ifndef DISABLE_DYNLOADING
         static oslModule                                s_hAccessibleImplementationModule = NULL;
 #endif
+#if HAVE_FEATURE_DESKTOP
         static GetStandardAccComponentFactory           s_pAccessibleFactoryFunc = NULL;
+#endif
         static ::rtl::Reference< IAccessibleFactory >   s_pFactory;
     }
 
@@ -260,7 +262,9 @@ namespace toolkit
             if( 0 == osl_atomic_decrement( &s_nAccessibilityClients ) )
             {
                 s_pFactory = NULL;
+#if HAVE_FEATURE_DESKTOP
                 s_pAccessibleFactoryFunc = NULL;
+#endif
                 if ( s_hAccessibleImplementationModule )
                 {
                     osl_unloadModule( s_hAccessibleImplementationModule );


More information about the Libreoffice-commits mailing list