From 27b6cdb5ab5af33dbba561923c8db81e144c88b9 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Wed, 2 Mar 2016 15:28:36 +0100 Subject: framework: avoid excessive queryDispatch calls Make better use of the css::frame::XInterceptorInfo interface, to avoid calling queryDispatch() pointlessly on interfaces that have explicitely opted out. Since that already broadcasts which urls we're interested in - so just don't bother calling entries who are not matching. Change-Id: Id5e780568fd60c38f4cee4ee800d747d65a31dae Reviewed-on: https://gerrit.libreoffice.org/25214 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- framework/source/dispatch/interceptionhelper.cxx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'framework') diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx index d205a53ba5f6..9772e5228757 100644 --- a/framework/source/dispatch/interceptionhelper.cxx +++ b/framework/source/dispatch/interceptionhelper.cxx @@ -52,16 +52,23 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD xInterceptor = pIt->xInterceptor; // b) No match by registration - but a valid interceptor list. - // Use first interceptor everytimes. - // Note: it doesn't matter, which direction this helper implementation use to ask interceptor objects. - // Using of member m_aInterceptorList will starts at the beginning everytimes. - // It depends from the filling operation, in which direction it works really! + // Find first interceptor w/o pattern, so we need to query it if (!xInterceptor.is() && m_lInterceptionRegs.size()>0) { - pIt = m_lInterceptionRegs.begin(); - xInterceptor = pIt->xInterceptor; + InterceptorList::const_iterator pIt2; + for (pIt2=m_lInterceptionRegs.begin(); pIt2!=m_lInterceptionRegs.end(); ++pIt2) + { + if (!pIt2->lURLPattern.getLength()) + { + // no pattern -> need to ask this guy! + xInterceptor = pIt2->xInterceptor; + break; + } + } + // if we didn't find any non-pattern interceptor, there's no-one + // registered for this command url (we already searched for matching + // patterns above) } - // c) No registered interceptor => use our direct slave. // This helper exist by design and must be valid everytimes ... // But to be more feature proof - we should check that .-) -- cgit