[Libreoffice-commits] core.git: framework/source

Thorsten Behrens Thorsten.Behrens at CIB.de
Fri May 20 23:44:24 UTC 2016


 framework/source/dispatch/interceptionhelper.cxx |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit 27b6cdb5ab5af33dbba561923c8db81e144c88b9
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Wed Mar 2 15:28:36 2016 +0100

    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 <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx
index d205a53..9772e52 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 .-)


More information about the Libreoffice-commits mailing list