summaryrefslogtreecommitdiff
path: root/ucbhelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-05-06 11:52:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-07 15:26:06 +0200
commita5af08b3ed160a569d389474dc5d5445dccf3a63 (patch)
tree676a9c73b4e59af2eebabb8edd4d65cdb3568130 /ucbhelper
parente855dc52266eab9b43f5f2f679c84eb6e30be46e (diff)
tdf#121740 fast path in cancelCommandExecution
skip the cost of constructing a SimpleIOErrorRequest in the common case Change-Id: Ib0a8989a9ffa76e6b71f984e0f32be94ec5cb8ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133959 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucbhelper')
-rw-r--r--ucbhelper/source/provider/cancelcommandexecution.cxx25
1 files changed, 19 insertions, 6 deletions
diff --git a/ucbhelper/source/provider/cancelcommandexecution.cxx b/ucbhelper/source/provider/cancelcommandexecution.cxx
index 89245ca78492..90c0168c6508 100644
--- a/ucbhelper/source/provider/cancelcommandexecution.cxx
+++ b/ucbhelper/source/provider/cancelcommandexecution.cxx
@@ -27,7 +27,9 @@
#include <rtl/ref.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <com/sun/star/ucb/CommandFailedException.hpp>
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
#include <ucbhelper/interactionrequest.hxx>
#include <ucbhelper/cancelcommandexecution.hxx>
#include "simpleioerrorrequest.hxx"
@@ -80,11 +82,23 @@ void cancelCommandExecution( const ucb::IOErrorCode eError,
const uno::Reference<
ucb::XCommandProcessor > & xContext )
{
- rtl::Reference< ucbhelper::SimpleIOErrorRequest > xRequest
- = new ucbhelper::SimpleIOErrorRequest(
- eError, rArgs, rMessage, xContext );
- if ( xEnv.is() )
+ if ( !xEnv )
+ {
+ // Fast path
+
+ ucb::InteractiveAugmentedIOException aRequest;
+ aRequest.Message = rMessage;
+ aRequest.Context = xContext;
+ aRequest.Classification = task::InteractionClassification_ERROR;
+ aRequest.Code = eError;
+ aRequest.Arguments = rArgs;
+ cppu::throwException( uno::Any( aRequest ) );
+ }
+ else
{
+ rtl::Reference< ucbhelper::SimpleIOErrorRequest > xRequest
+ = new ucbhelper::SimpleIOErrorRequest(
+ eError, rArgs, rMessage, xContext );
uno::Reference<
task::XInteractionHandler > xIH = xEnv->getInteractionHandler();
if ( xIH.is() )
@@ -99,10 +113,9 @@ void cancelCommandExecution( const ucb::IOErrorCode eError,
xContext,
xRequest->getRequest() );
}
+ cppu::throwException( xRequest->getRequest() );
}
- cppu::throwException( xRequest->getRequest() );
-
OSL_FAIL( "Return from cppu::throwException call!!!" );
throw uno::RuntimeException();
}