Kaydet (Commit) a4ed79bb authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Shortcut common case of calling same-env component_getFactory fn

Change-Id: I7f5d31c3b3e128b2df4d83c915673bf7b5d2ab8c
üst d2038559
...@@ -188,47 +188,57 @@ Reference< XInterface > invokeComponentFactory( ...@@ -188,47 +188,57 @@ Reference< XInterface > invokeComponentFactory(
fprintf(stderr, "invokeComponentFactory envDcp:%s implName:%s modPath:%s\n", envDcp.getStr(), implName.getStr(), modPath.getStr()); fprintf(stderr, "invokeComponentFactory envDcp:%s implName:%s modPath:%s\n", envDcp.getStr(), implName.getStr(), modPath.getStr());
} }
#endif #endif
if (env.get() == currentEnv.get())
Mapping aCurrent2Env( currentEnv, env );
Mapping aEnv2Current( env, currentEnv );
if (aCurrent2Env.is() && aEnv2Current.is())
{ {
void * pSMgr = aCurrent2Env.mapInterface( xRet.set(
xMgr.get(), ::getCppuType( &xMgr ) ); static_cast<css::uno::XInterface *>(
(*reinterpret_cast<component_getFactoryFunc>(pGetter))(
aImplName.getStr(), xMgr.get(), 0)),
SAL_NO_ACQUIRE);
}
else
{
Mapping aCurrent2Env( currentEnv, env );
Mapping aEnv2Current( env, currentEnv );
void * pSSF = NULL; if (aCurrent2Env.is() && aEnv2Current.is())
{
void * pSMgr = aCurrent2Env.mapInterface(
xMgr.get(), ::getCppuType( &xMgr ) );
env.invoke(s_getFactory, pGetter, &aImplName, pSMgr, 0, &pSSF); void * pSSF = NULL;
if (pSMgr) env.invoke(s_getFactory, pGetter, &aImplName, pSMgr, 0, &pSSF);
{
(*env.get()->pExtEnv->releaseInterface)(
env.get()->pExtEnv, pSMgr );
}
if (pSSF) if (pSMgr)
{ {
aEnv2Current.mapInterface( (*env.get()->pExtEnv->releaseInterface)(
reinterpret_cast< void ** >( &xRet ), env.get()->pExtEnv, pSMgr );
pSSF, ::getCppuType( &xRet ) ); }
(env.get()->pExtEnv->releaseInterface)(
env.get()->pExtEnv, pSSF ); if (pSSF)
{
aEnv2Current.mapInterface(
reinterpret_cast< void ** >( &xRet ),
pSSF, ::getCppuType( &xRet ) );
(env.get()->pExtEnv->releaseInterface)(
env.get()->pExtEnv, pSSF );
}
else
{
rExcMsg = rModulePath +
": cannot get factory of " +
"demanded implementation: " +
OStringToOUString(
aImplName, RTL_TEXTENCODING_ASCII_US );
}
} }
else else
{ {
rExcMsg = rModulePath + rExcMsg =
": cannot get factory of " + "cannot get uno mappings: C++ <=> UNO!";
"demanded implementation: " +
OStringToOUString(
aImplName, RTL_TEXTENCODING_ASCII_US );
} }
} }
else
{
rExcMsg =
"cannot get uno mappings: C++ <=> UNO!";
}
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment