summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-02-28 09:51:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-02-28 11:48:42 +0000
commit69794d012fa640d60fd808e1d576cb919129ade4 (patch)
tree8fa47398287367c1054d0f0399cb431cd590b714 /package
parentefc5cbdad54fc2aa968af572dd5f135123217f8f (diff)
no need to allocate OTypeCollection separately in OStorage
it is only one pointer big Change-Id: I4af56814be106026515aee6c09caa14e0f3eb09a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147948 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package')
-rw-r--r--package/source/xstor/xstorage.cxx30
-rw-r--r--package/source/xstor/xstorage.hxx3
2 files changed, 17 insertions, 16 deletions
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 51fb867f1be5..f94a9fbdf9b5 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -2087,18 +2087,18 @@ void SAL_CALL OStorage::release() noexcept
// XTypeProvider
uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes()
{
- if (! m_pTypeCollection)
+ if (! m_oTypeCollection)
{
::osl::MutexGuard aGuard( m_xSharedMutex->GetMutex() );
- if (! m_pTypeCollection)
+ if (! m_oTypeCollection)
{
if ( m_pImpl->m_nStorageType == embed::StorageFormats::PACKAGE )
{
if ( m_pImpl->m_bIsRoot )
{
- m_pTypeCollection.reset(new ::cppu::OTypeCollection
- ( cppu::UnoType<lang::XTypeProvider>::get()
+ m_oTypeCollection.emplace(
+ cppu::UnoType<lang::XTypeProvider>::get()
, cppu::UnoType<embed::XStorage>::get()
, cppu::UnoType<embed::XStorage2>::get()
, cppu::UnoType<embed::XStorageRawAccess>::get()
@@ -2108,46 +2108,46 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes()
, cppu::UnoType<embed::XEncryptionProtectedStorage>::get()
, cppu::UnoType<embed::XEncryptionProtectedSource2>::get()
, cppu::UnoType<embed::XEncryptionProtectedSource>::get()
- , cppu::UnoType<beans::XPropertySet>::get()));
+ , cppu::UnoType<beans::XPropertySet>::get());
}
else
{
- m_pTypeCollection.reset(new ::cppu::OTypeCollection
- ( cppu::UnoType<lang::XTypeProvider>::get()
+ m_oTypeCollection.emplace(
+ cppu::UnoType<lang::XTypeProvider>::get()
, cppu::UnoType<embed::XStorage>::get()
, cppu::UnoType<embed::XStorage2>::get()
, cppu::UnoType<embed::XStorageRawAccess>::get()
, cppu::UnoType<embed::XTransactedObject>::get()
, cppu::UnoType<embed::XTransactionBroadcaster>::get()
, cppu::UnoType<util::XModifiable>::get()
- , cppu::UnoType<beans::XPropertySet>::get()));
+ , cppu::UnoType<beans::XPropertySet>::get());
}
}
else if ( m_pImpl->m_nStorageType == embed::StorageFormats::OFOPXML )
{
- m_pTypeCollection.reset(new ::cppu::OTypeCollection
- ( cppu::UnoType<lang::XTypeProvider>::get()
+ m_oTypeCollection.emplace(
+ cppu::UnoType<lang::XTypeProvider>::get()
, cppu::UnoType<embed::XStorage>::get()
, cppu::UnoType<embed::XTransactedObject>::get()
, cppu::UnoType<embed::XTransactionBroadcaster>::get()
, cppu::UnoType<util::XModifiable>::get()
, cppu::UnoType<embed::XRelationshipAccess>::get()
- , cppu::UnoType<beans::XPropertySet>::get()));
+ , cppu::UnoType<beans::XPropertySet>::get());
}
else
{
- m_pTypeCollection.reset(new ::cppu::OTypeCollection
- ( cppu::UnoType<lang::XTypeProvider>::get()
+ m_oTypeCollection.emplace(
+ cppu::UnoType<lang::XTypeProvider>::get()
, cppu::UnoType<embed::XStorage>::get()
, cppu::UnoType<embed::XTransactedObject>::get()
, cppu::UnoType<embed::XTransactionBroadcaster>::get()
, cppu::UnoType<util::XModifiable>::get()
- , cppu::UnoType<beans::XPropertySet>::get()));
+ , cppu::UnoType<beans::XPropertySet>::get());
}
}
}
- return m_pTypeCollection->getTypes() ;
+ return m_oTypeCollection->getTypes() ;
}
uno::Sequence< sal_Int8 > SAL_CALL OStorage::getImplementationId()
diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx
index 1fefb8f4671a..a32aeca1d25d 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -53,6 +53,7 @@
#include <vector>
#include <memory>
+#include <optional>
#include <string_view>
namespace com::sun::star::uno {
@@ -280,7 +281,7 @@ class OStorage final : public css::lang::XTypeProvider
OStorage_Impl* m_pImpl;
rtl::Reference<comphelper::RefCountedMutex> m_xSharedMutex;
comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenersContainer; // list of listeners
- ::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection;
+ ::std::optional< ::cppu::OTypeCollection> m_oTypeCollection;
bool m_bReadOnlyWrap;
::rtl::Reference<OChildDispListener_Impl> m_pSubElDispListener;
::std::vector< css::uno::WeakReference< css::lang::XComponent > > m_aOpenSubComponentsVector;