summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-04-06 19:30:16 +0300
committerTor Lillqvist <tml@iki.fi>2013-04-07 01:13:36 +0300
commit9e6afcf1624cbde7cc48c94d9062f91b4b1abbec (patch)
tree95397d65ea6bb80a2a69900587a1dff549380040 /bridges
parent2b8be1c679c40d337b485ae7a29516ed7408d479 (diff)
Pre-cache type_info for com::sun::star::ucb::InteractiveAugmentedIOException
It seems to be the type_info most commonly looked up dynamically, even the only one in an initial test. I think it is a good idea to avoid dlsym() if possible. Change-Id: I0379c534e10efefafdd253ee651f6c74e4aa47d5
Diffstat (limited to 'bridges')
-rw-r--r--bridges/Library_cpp_uno.mk1
-rw-r--r--bridges/source/cpp_uno/gcc3_ios_arm/except.cxx31
2 files changed, 17 insertions, 15 deletions
diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk
index b19753f67b5c..d0fe43e14cba 100644
--- a/bridges/Library_cpp_uno.mk
+++ b/bridges/Library_cpp_uno.mk
@@ -28,6 +28,7 @@ bridge_cxx_objects := cpp2uno uno2cpp
else ifeq ($(CPU),R)
ifeq ($(OS),IOS)
+$(eval $(call gb_Library_use_sdk_api,gcc3_uno))
bridges_SELECTED_BRIDGE := gcc3_ios_arm
bridge_asm_objects := helper
bridge_exception_objects := cpp2uno cpp2uno-arm cpp2uno-i386 except uno2cpp uno2cpp-arm uno2cpp-i386
diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx
index 45c6956f122e..e0232978b0a5 100644
--- a/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx
@@ -28,13 +28,13 @@
#include <osl/mutex.hxx>
#include <com/sun/star/uno/genfunc.hxx>
-#include "com/sun/star/uno/RuntimeException.hpp"
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
#include <typelib/typedescription.hxx>
#include <uno/any2.h>
#include "share.hxx"
-
using namespace ::std;
using namespace ::osl;
using namespace ::rtl;
@@ -51,8 +51,6 @@ void dummy_can_throw_anything( char const * )
//==================================================================================================
static OUString toUNOname( char const * p ) SAL_THROW(())
{
- char const * start = p;
-
// example: N3com3sun4star4lang24IllegalArgumentExceptionE
OUStringBuffer buf( 64 );
@@ -76,15 +74,13 @@ static OUString toUNOname( char const * p ) SAL_THROW(())
OUString result( buf.makeStringAndClear() );
- SAL_INFO( "bridges.ios", "toUNOname():" << start << " => " << result );
-
return result;
}
//==================================================================================================
class RTTI
{
- typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
+ typedef boost::unordered_map< OUString, const type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
@@ -96,12 +92,16 @@ public:
RTTI() SAL_THROW(());
~RTTI() SAL_THROW(());
- type_info * getRTTI( typelib_CompoundTypeDescription * ) SAL_THROW(());
+ const type_info * getRTTI( typelib_CompoundTypeDescription * ) SAL_THROW(());
};
//__________________________________________________________________________________________________
RTTI::RTTI() SAL_THROW(())
: m_hApp( dlopen( 0, RTLD_LAZY ) )
{
+ // Insert commonly needed type_infos to avoid dlsym() calls
+ // Ideally we should insert all needed ones
+ m_rttis.insert( t_rtti_map::value_type( "com.sun.star.ucb.InteractiveAugmentedIOException",
+ &typeid( com::sun::star::ucb::InteractiveAugmentedIOException ) ) );
}
//__________________________________________________________________________________________________
RTTI::~RTTI() SAL_THROW(())
@@ -110,9 +110,9 @@ RTTI::~RTTI() SAL_THROW(())
}
//__________________________________________________________________________________________________
-type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THROW(())
+const type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THROW(())
{
- type_info * rtti;
+ const type_info * rtti;
OUString const & unoName = *(OUString const *)&pTypeDescr->aBase.pTypeName;
@@ -135,6 +135,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
buf.append( 'E' );
OString symName( buf.makeStringAndClear() );
+ SAL_INFO( "bridges.ios", "getRTTI: calling dlsym() for type_info for " << unoName );
rtti = (type_info *)dlsym( m_hApp, symName.getStr() );
if (rtti)
@@ -161,7 +162,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
if (pTypeDescr->pBaseTypeDescription)
{
// ensure availability of base
- type_info * base_rtti = getRTTI(
+ const type_info * base_rtti = getRTTI(
(typelib_CompoundTypeDescription *)pTypeDescr->pBaseTypeDescription );
rtti = new __si_class_type_info(
strdup( rttiName ), (__class_type_info *)base_rtti );
@@ -210,10 +211,10 @@ static void deleteException( void * pExc )
//==================================================================================================
void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
{
- SAL_INFO( "bridges.ios", "raiseException: " << pUnoExc->pType->pTypeName );
+ SAL_INFO( "bridges.ios", "raiseException: " << *reinterpret_cast< OUString const * >( &pUnoExc->pType->pTypeName ) );
void * pCppExc;
- type_info * rtti;
+ const type_info * rtti;
{
// construct cpp exception object
@@ -248,7 +249,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
#endif
}
}
- rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
+ rtti = s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
TYPELIB_DANGER_RELEASE( pTypeDescr );
OSL_ENSURE( rtti, "### no rtti for throwing exception!" );
@@ -261,7 +262,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
}
}
- __cxa_throw( pCppExc, rtti, deleteException );
+ __cxa_throw( pCppExc, (type_info *) rtti, deleteException );
}
//==================================================================================================