[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - comphelper/source desktop/source include/comphelper toolkit/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 15 12:42:32 UTC 2021
comphelper/source/misc/profilezone.cxx | 27 +++++++++++++++------------
desktop/source/lib/init.cxx | 2 +-
include/comphelper/profilezone.hxx | 3 ++-
toolkit/source/awt/vclxtoolkit.cxx | 4 ++--
4 files changed, 20 insertions(+), 16 deletions(-)
New commits:
commit 64a115ea0bbe76c974a90ffb615895b222568b84
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Apr 14 12:47:14 2021 +0300
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Apr 15 14:41:08 2021 +0200
Clarify the ProfileRecording API
Instead of a startRecording(bool) function that is used to also stop
recording, have separate startRecording() and stopRecording()
functions that do what they say.
Change-Id: Ifa9ea0e530d5d38baa52f685fc1dc0029d30d023
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114081
Tested-by: Tor Lillqvist <tml at collabora.com>
Reviewed-by: Tor Lillqvist <tml at collabora.com>
diff --git a/comphelper/source/misc/profilezone.cxx b/comphelper/source/misc/profilezone.cxx
index f9284b1f4a51..dc945c7f715d 100644
--- a/comphelper/source/misc/profilezone.cxx
+++ b/comphelper/source/misc/profilezone.cxx
@@ -32,17 +32,19 @@ static int g_aNesting; // level of overlapped zones
static long long g_aStartTime; // start time of recording
static ::osl::Mutex g_aMutex;
-void startRecording(bool bStartRecording)
+void startRecording()
{
- if (bStartRecording)
- {
- TimeValue systemTime;
- osl_getSystemTime( &systemTime );
- ::osl::MutexGuard aGuard( g_aMutex );
- g_aStartTime = static_cast<long long>(systemTime.Seconds) * 1000000 + systemTime.Nanosec/1000;
- g_aNesting = 0;
- }
- ProfileZone::g_bRecording = bStartRecording;
+ TimeValue systemTime;
+ osl_getSystemTime( &systemTime );
+ ::osl::MutexGuard aGuard( g_aMutex );
+ g_aStartTime = static_cast<long long>(systemTime.Seconds) * 1000000 + systemTime.Nanosec/1000;
+ g_aNesting = 0;
+ ProfileZone::g_bRecording = true;
+}
+
+void stopRecording()
+{
+ ProfileZone::g_bRecording = false;
}
long long addRecording(const char * aProfileId, long long aCreateTime)
@@ -88,13 +90,14 @@ css::uno::Sequence<OUString> getRecordingAndClear()
{
::osl::MutexGuard aGuard( g_aMutex );
bRecording = ProfileZone::g_bRecording;
- startRecording(false);
+ stopRecording();
aRecording.swap(g_aRecording);
long long aSumTime = g_aSumTime;
aRecording.insert(aRecording.begin(), OUString::number(aSumTime/1000000.0));
}
// reset start time and nesting level
- startRecording(bRecording);
+ if (bRecording)
+ startRecording();
return ::comphelper::containerToSequence(aRecording);
}
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bc21a07e5ac5..a484cf607d60 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6151,7 +6151,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// Turn profile zones on early
if (bProfileZones && eStage == SECOND_INIT)
{
- comphelper::ProfileRecording::startRecording(true);
+ comphelper::ProfileRecording::startRecording();
new ProfileZoneDumper();
}
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx
index f1276e64cd67..0c0df2089c98 100644
--- a/include/comphelper/profilezone.hxx
+++ b/include/comphelper/profilezone.hxx
@@ -24,7 +24,8 @@ namespace comphelper
{
namespace ProfileRecording
{
-COMPHELPER_DLLPUBLIC void startRecording(bool bRecording);
+COMPHELPER_DLLPUBLIC void startRecording();
+COMPHELPER_DLLPUBLIC void stopRecording();
COMPHELPER_DLLPUBLIC long long addRecording(const char* aProfileId, long long aCreateTime);
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 8d7cff46e7d8..2e35c8afb6bc 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -2562,12 +2562,12 @@ void SAL_CALL VCLXToolkit::pause(sal_Int32 nMilliseconds)
void SAL_CALL VCLXToolkit::startRecording()
{
- ::comphelper::ProfileRecording::startRecording(true);
+ ::comphelper::ProfileRecording::startRecording();
}
void SAL_CALL VCLXToolkit::stopRecording()
{
- ::comphelper::ProfileRecording::startRecording( false );
+ ::comphelper::ProfileRecording::stopRecording();
}
css::uno::Sequence< OUString > VCLXToolkit::getRecordingAndClear()
More information about the Libreoffice-commits
mailing list