[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - dtrans/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 1 13:38:44 UTC 2020
dtrans/source/win32/clipb/WinClipbImpl.cxx | 12 ++++++++++++
dtrans/source/win32/clipb/WinClipbImpl.hxx | 1 +
2 files changed, 13 insertions(+)
New commits:
commit 9b311cabd908c6bc9e7f7d461ee11eaf0ea6b18c
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri May 29 18:15:30 2020 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Jun 1 15:38:14 2020 +0200
cache foreign content in win32 clipboard code (tdf#133267)
The slowness in tdf#133267 on Windows is because the Calc operation
repeatedly calls ScDocument::IsClipboardSource(), which calls
ScModule::GetClipDoc(), which proceeds to fetch the clipboard
content, which means fetching it from the system clipboard if it's
not owned by LO.
Other LO clipboard implementations such as gtk3 or qt5 already
do caching, and it seems that it's easy to do for the win32 code.
Change-Id: I4696cc7488d66803fd5dd2963d27900957decdec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95163
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
(cherry picked from commit fda6ad1458fcd5087c3dde56300b9d0367af6db5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95246
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/dtrans/source/win32/clipb/WinClipbImpl.cxx b/dtrans/source/win32/clipb/WinClipbImpl.cxx
index 003a266f84bc..8d59be7ca430 100644
--- a/dtrans/source/win32/clipb/WinClipbImpl.cxx
+++ b/dtrans/source/win32/clipb/WinClipbImpl.cxx
@@ -83,6 +83,10 @@ Reference< XTransferable > CWinClipbImpl::getContents( )
return m_pCurrentClipContent->m_XTransferable;
}
+ // Content cached?
+ if (m_foreignContent.is())
+ return m_foreignContent;
+
// release the mutex, so that the variable may be
// changed by other threads
}
@@ -101,6 +105,9 @@ Reference< XTransferable > CWinClipbImpl::getContents( )
// remember pIDo destroys itself due to the smart pointer
rClipContent = CDOTransferable::create( m_pWinClipboard->m_xContext, pIDo );
+
+ MutexGuard aGuard(m_ClipContentMutex);
+ m_foreignContent = rClipContent;
}
return rClipContent;
@@ -117,6 +124,8 @@ void CWinClipbImpl::setContents(
{
MutexGuard aGuard(m_ClipContentMutex);
+ m_foreignContent.clear();
+
m_pCurrentClipContent
= new CXNotifyingDataObject(CDTransObjFactory::createDataObjFromTransferable(
m_pWinClipboard->m_xContext, xTransferable),
@@ -176,7 +185,10 @@ void WINAPI CWinClipbImpl::onClipboardContentChanged()
// reassociation to instance through static member
if ( nullptr != s_pCWinClipbImpl )
+ {
+ s_pCWinClipbImpl->m_foreignContent.clear();
s_pCWinClipbImpl->m_pWinClipboard->notifyAllClipboardListener( );
+ }
}
void CWinClipbImpl::onReleaseDataObject( CXNotifyingDataObject* theCaller )
diff --git a/dtrans/source/win32/clipb/WinClipbImpl.hxx b/dtrans/source/win32/clipb/WinClipbImpl.hxx
index 55a9d8d600bc..cd5878e6b794 100644
--- a/dtrans/source/win32/clipb/WinClipbImpl.hxx
+++ b/dtrans/source/win32/clipb/WinClipbImpl.hxx
@@ -87,6 +87,7 @@ private:
CMtaOleClipboard m_MtaOleClipboard;
CWinClipboard* m_pWinClipboard;
CXNotifyingDataObject* m_pCurrentClipContent;
+ com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable > m_foreignContent;
osl::Mutex m_ClipContentMutex;
static osl::Mutex s_aMutex;
More information about the Libreoffice-commits
mailing list