summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorThorsten Behrens <thorsten.behrens@allotropia.de>2021-09-25 18:03:31 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2022-01-19 14:26:09 +0100
commitc367a2781f99ed22d0f7d64184fb567aacc43f35 (patch)
tree7a12e0e485aeac4fae08dd9925310d7cbac95ed9 /cppuhelper
parentcb65cf92b91873bfd13c96250c782998f1eef337 (diff)
WASM UNO: add a minimal dummy bridge
... and use the same fake exception rethrowing code then the mobile platforms. Change-Id: Ic90de1cfd1e0092d6064d041a613d60d9f5f76b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128596 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/exc_thrower.cxx17
-rw-r--r--cppuhelper/source/paths.cxx4
2 files changed, 14 insertions, 7 deletions
diff --git a/cppuhelper/source/exc_thrower.cxx b/cppuhelper/source/exc_thrower.cxx
index 1bb8bfab13b3..c0d441fcd48b 100644
--- a/cppuhelper/source/exc_thrower.cxx
+++ b/cppuhelper/source/exc_thrower.cxx
@@ -168,9 +168,15 @@ ExceptionThrower::ExceptionThrower()
uno_Interface::pDispatcher = ExceptionThrower_dispatch;
}
+#if defined(IOS) || (defined(__aarch64__) && defined(ANDROID)) || defined(EMSCRIPTEN)
+#define RETHROW_FAKE_EXCEPTIONS 1
+#else
+#define RETHROW_FAKE_EXCEPTIONS 0
+#endif
+
class theExceptionThrower : public rtl::Static<ExceptionThrower, theExceptionThrower> {};
-#if defined(IOS) || (defined(__aarch64__) && defined(ANDROID))
+#if RETHROW_FAKE_EXCEPTIONS
// In the native iOS / Android app, where we don't have any Java, Python,
// BASIC, or other scripting, the only thing that would use the C++/UNO bridge
// functionality that invokes codeSnippet() was cppu::throwException().
@@ -208,7 +214,7 @@ void lo_mobile_throwException(css::uno::Any const& aException)
assert(false);
}
-#endif // defined(IOS) || (defined(__aarch64__) && defined(ANDROID))
+#endif // RETHROW_FAKE_EXCEPTIONS
} // anonymous namespace
@@ -226,7 +232,7 @@ void SAL_CALL throwException( Any const & exc )
"(must be derived from com::sun::star::uno::Exception)!" );
}
-#if defined(IOS) || (defined(__aarch64__) && defined(ANDROID))
+#if RETHROW_FAKE_EXCEPTIONS
lo_mobile_throwException(exc);
#else
Mapping uno2cpp(Environment(UNO_LB_UNO), Environment::getCurrent());
@@ -243,13 +249,14 @@ void SAL_CALL throwException( Any const & exc )
ExceptionThrower::getCppuType() );
OSL_ASSERT( xThrower.is() );
xThrower->throwException( exc );
-#endif
+#endif // !RETHROW_FAKE_EXCEPTIONS
}
Any SAL_CALL getCaughtException()
{
-#if defined(__aarch64__) && defined(ANDROID)
+ // why does this differ from RETHROW_FAKE_EXCEPTIONS?
+#if (defined(__aarch64__) && defined(ANDROID)) || defined(EMSCRIPTEN)
// FIXME This stuff works on 32bit ARM, let's use the shortcut only for
// the 64bit ARM.
return Any();
diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx
index 785fa452d30b..d2f37bb549a7 100644
--- a/cppuhelper/source/paths.cxx
+++ b/cppuhelper/source/paths.cxx
@@ -33,7 +33,7 @@
namespace {
-#ifndef ANDROID
+#if !(defined ANDROID || defined EMSCRIPTEN)
OUString get_this_libpath() {
static OUString s_uri = []() {
OUString uri;
@@ -52,7 +52,7 @@ OUString get_this_libpath() {
}
OUString cppu::getUnoIniUri() {
-#if defined ANDROID
+#if defined ANDROID || defined EMSCRIPTEN
// Wouldn't it be lovely to avoid this ugly hard-coding.
// The problem is that the 'create_bootstrap_macro_expander_factory()'
// required for bootstrapping services, calls cppu::get_unorc directly