[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 29 08:38:00 UTC 2021


 comphelper/source/misc/traceevent.cxx |   36 +++++++++++++++++-----------------
 desktop/source/lib/init.cxx           |    8 +++----
 include/comphelper/profilezone.hxx    |    5 ----
 include/comphelper/traceevent.hxx     |    5 ++++
 toolkit/source/awt/vclxtoolkit.cxx    |    4 +--
 5 files changed, 29 insertions(+), 29 deletions(-)

New commits:
commit 3ed51f7b24eac38e4263da8d5bfa10ab6e6d3161
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Apr 27 10:48:09 2021 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Apr 29 10:37:22 2021 +0200

    Move some static functions from ProfileZone to TraceEvent where they belong
    
    Change-Id: I35f3d5d8c0a69a224cf7d3a2decba9c8e13c7dc1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114792
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/comphelper/source/misc/traceevent.cxx b/comphelper/source/misc/traceevent.cxx
index aa99e8bf7e39..6e86c3f03993 100644
--- a/comphelper/source/misc/traceevent.cxx
+++ b/comphelper/source/misc/traceevent.cxx
@@ -67,14 +67,30 @@ void TraceEvent::addInstantEvent(const char* sProfileId)
                  + OUString::number(osl_getThreadIdentifier(nullptr)) + "},");
 }
 
-void ProfileZone::startRecording()
+void TraceEvent::startRecording()
 {
     ::osl::MutexGuard aGuard(g_aMutex);
     s_nNesting = 0;
     s_bRecording = true;
 }
 
-void ProfileZone::stopRecording() { s_bRecording = false; }
+void TraceEvent::stopRecording() { s_bRecording = false; }
+
+css::uno::Sequence<OUString> TraceEvent::getRecordingAndClear()
+{
+    bool bRecording;
+    std::vector<OUString> aRecording;
+    {
+        ::osl::MutexGuard aGuard(g_aMutex);
+        bRecording = s_bRecording;
+        stopRecording();
+        aRecording.swap(g_aRecording);
+    }
+    // reset start time and nesting level
+    if (bRecording)
+        startRecording();
+    return ::comphelper::containerToSequence(aRecording);
+}
 
 void ProfileZone::addRecording()
 {
@@ -104,22 +120,6 @@ void ProfileZone::addRecording()
                              + OUString::number(osl_getThreadIdentifier(nullptr)) + "},");
 }
 
-css::uno::Sequence<OUString> ProfileZone::getRecordingAndClear()
-{
-    bool bRecording;
-    std::vector<OUString> aRecording;
-    {
-        ::osl::MutexGuard aGuard(g_aMutex);
-        bRecording = s_bRecording;
-        stopRecording();
-        aRecording.swap(g_aRecording);
-    }
-    // reset start time and nesting level
-    if (bRecording)
-        startRecording();
-    return ::comphelper::containerToSequence(aRecording);
-}
-
 void ProfileZone::startConsole() { m_nCreateTime = osl_getGlobalTimer(); }
 
 void ProfileZone::stopConsole()
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index e92c916f1e5f..c0839e63f778 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3850,9 +3850,9 @@ static void lo_setOption(LibreOfficeKit* /*pThis*/, const char *pOption, const c
     if (strcmp(pOption, "profilezonerecording") == 0)
     {
         if (strcmp(pValue, "start") == 0)
-            comphelper::ProfileZone::startRecording();
+            comphelper::TraceEvent::startRecording();
         else if (strcmp(pValue, "stop") == 0)
-            comphelper::ProfileZone::stopRecording();
+            comphelper::TraceEvent::stopRecording();
     }
     else if (strcmp(pOption, "sallogoverride") == 0)
     {
@@ -6110,7 +6110,7 @@ public:
     virtual void Invoke() override
     {
         const css::uno::Sequence<OUString> aEvents =
-            comphelper::ProfileZone::getRecordingAndClear();
+            comphelper::TraceEvent::getRecordingAndClear();
         OStringBuffer aOutput;
         for (const auto &s : aEvents)
         {
@@ -6192,7 +6192,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
     // Turn profile zones on early
     if (bProfileZones && eStage == SECOND_INIT)
     {
-        comphelper::ProfileZone::startRecording();
+        comphelper::TraceEvent::startRecording();
         new ProfileZoneDumper();
     }
 
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx
index bd54667b1980..7525b6322152 100644
--- a/include/comphelper/profilezone.hxx
+++ b/include/comphelper/profilezone.hxx
@@ -86,11 +86,6 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public TraceEvent
 
     ProfileZone(const ProfileZone&) = delete;
     void operator=(const ProfileZone&) = delete;
-
-    static void startRecording();
-    static void stopRecording();
-
-    static css::uno::Sequence<OUString> getRecordingAndClear();
 };
 
 } // namespace comphelper
diff --git a/include/comphelper/traceevent.hxx b/include/comphelper/traceevent.hxx
index 5c922b281487..14e25da9b791 100644
--- a/include/comphelper/traceevent.hxx
+++ b/include/comphelper/traceevent.hxx
@@ -34,6 +34,11 @@ protected:
 
 public:
     static void addInstantEvent(const char* sProfileId);
+
+    static void startRecording();
+    static void stopRecording();
+
+    static css::uno::Sequence<OUString> getRecordingAndClear();
 };
 
 } // namespace comphelper
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 1bd84af19f0f..c250a5d2ad5c 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::ProfileZone::startRecording();
+    comphelper::TraceEvent::startRecording();
 }
 
 void SAL_CALL VCLXToolkit::stopRecording()
 {
-    comphelper::ProfileZone::stopRecording();
+    comphelper::TraceEvent::stopRecording();
 }
 
 css::uno::Sequence< OUString > VCLXToolkit::getRecordingAndClear()


More information about the Libreoffice-commits mailing list