summaryrefslogtreecommitdiff
path: root/comphelper/source/misc/simplefileaccessinteraction.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-10-02 10:25:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-10-02 13:07:00 +0200
commite3c961e6a3917d95534652e0f982918cc1079015 (patch)
tree1efa9761d9d2159f06800f1f15b625a7dcc15d47 /comphelper/source/misc/simplefileaccessinteraction.cxx
parentfa229eb1ecbcbb7b861679158ad706e37d454526 (diff)
reduce allocations in InterceptedInteraction
the list of intercepted interactions is static per sub-class, so just pass up a o3tl::span at constructor time. Change-Id: Ib45c5a3338e0eb3848486dfc707052f07492eb61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157480 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper/source/misc/simplefileaccessinteraction.cxx')
-rw-r--r--comphelper/source/misc/simplefileaccessinteraction.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/comphelper/source/misc/simplefileaccessinteraction.cxx b/comphelper/source/misc/simplefileaccessinteraction.cxx
index 8cd77af7d693..f7a4f0eab237 100644
--- a/comphelper/source/misc/simplefileaccessinteraction.cxx
+++ b/comphelper/source/misc/simplefileaccessinteraction.cxx
@@ -29,10 +29,9 @@ const sal_Int32 HANDLE_CERTIFICATEREQUEST = 3;
/// Will handle com::sun::star::ucb::AuthenticationRequest
const sal_Int32 HANDLE_AUTHENTICATIONREQUEST = 4;
-SimpleFileAccessInteraction::SimpleFileAccessInteraction(
- const css::uno::Reference<css::task::XInteractionHandler>& xHandler)
+static o3tl::span<const ::ucbhelper::InterceptedInteraction::InterceptedRequest> getInterceptions()
{
- std::vector<::ucbhelper::InterceptedInteraction::InterceptedRequest> lInterceptions{
+ static const ::ucbhelper::InterceptedInteraction::InterceptedRequest lInterceptions[]{
{ //intercept standard IO error exception (local file and WebDAV)
css::uno::Any(css::ucb::InteractiveIOException()),
cppu::UnoType<css::task::XInteractionAbort>::get(), HANDLE_INTERACTIVEIOEXCEPTION },
@@ -52,9 +51,14 @@ SimpleFileAccessInteraction::SimpleFileAccessInteraction(
css::uno::Any(css::ucb::AuthenticationRequest()),
cppu::UnoType<css::task::XInteractionApprove>::get(), HANDLE_AUTHENTICATIONREQUEST }
};
+ return lInterceptions;
+}
+SimpleFileAccessInteraction::SimpleFileAccessInteraction(
+ const css::uno::Reference<css::task::XInteractionHandler>& xHandler)
+ : InterceptedInteraction(getInterceptions())
+{
setInterceptedHandler(xHandler);
- setInterceptions(std::move(lInterceptions));
}
SimpleFileAccessInteraction::~SimpleFileAccessInteraction() {}