include/comphelper/profilezone.hxx |   36 +++++++++++++++++++++++-------------
 include/comphelper/traceevent.hxx  |   20 +++++++++++++++-----
 2 files changed, 38 insertions(+), 18 deletions(-)

New commits:
commit e42bcedec1c825e4cbc6eb0e955dd4e26696c4d4
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Mon May 31 15:55:20 2021 +0300
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Mon May 31 16:08:10 2021 +0200

    Avoid empty std::map constructor
    
    Change-Id: Ie1bc333409fb201d82dd2cff7597e281600f01db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116449
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tor Lillqvist <t...@collabora.com>

diff --git a/include/comphelper/profilezone.hxx 
b/include/comphelper/profilezone.hxx
index c3e68f83ce13..f771a618fb54 100644
--- a/include/comphelper/profilezone.hxx
+++ b/include/comphelper/profilezone.hxx
@@ -31,6 +31,23 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent
 
     void addRecording();
 
+ ProfileZone(const char* sName, const OUString &sArgs, bool bConsole)
+        : NamedEvent(sName, sArgs)
+        , m_bConsole(bConsole)
+        , m_nNesting(-1)
+    {
+        if (s_bRecording || m_bConsole)
+        {
+            TimeValue systemTime;
+            osl_getSystemTime( &systemTime );
+            m_nCreateTime = static_cast<long long>(systemTime.Seconds) * 
1000000 + systemTime.Nanosec/1000;
+
+            m_nNesting = s_nNesting++;
+        }
+        else
+            m_nCreateTime = 0;
+    }
+
  public:
 
     /**
@@ -48,21 +65,14 @@ class COMPHELPER_DLLPUBLIC ProfileZone : public NamedEvent
      * Similar to the DEBUG macro in sal/log.hxx, don't forget to remove these 
lines before
      * committing.
      */
-    ProfileZone(const char* sName, bool bConsole = false, const 
std::map<OUString, OUString> &args = std::map<OUString, OUString>())
-        : NamedEvent(sName, args)
-        , m_bConsole(bConsole)
-        , m_nNesting(-1)
+    ProfileZone(const char* sName, const std::map<OUString, OUString> &aArgs, 
bool bConsole = false)
+        : ProfileZone(sName, createArgsString(aArgs), bConsole)
     {
-        if (s_bRecording || m_bConsole)
-        {
-            TimeValue systemTime;
-            osl_getSystemTime( &systemTime );
-            m_nCreateTime = static_cast<long long>(systemTime.Seconds) * 
1000000 + systemTime.Nanosec/1000;
+    }
 
-            m_nNesting = s_nNesting++;
-        }
-        else
-            m_nCreateTime = 0;
+    ProfileZone(const char* sName, bool bConsole = false)
+        : ProfileZone(sName, OUString(), bConsole)
+    {
     }
 
     ~ProfileZone()
diff --git a/include/comphelper/traceevent.hxx 
b/include/comphelper/traceevent.hxx
index 339e924e637d..d3189cbc85f1 100644
--- a/include/comphelper/traceevent.hxx
+++ b/include/comphelper/traceevent.hxx
@@ -82,12 +82,17 @@ protected:
     const int m_nPid;
     const OUString m_sArgs;
 
-    TraceEvent(std::map<OUString, OUString> args)
+    TraceEvent(const OUString& sArgs)
         : m_nPid(getPid())
-        , m_sArgs(createArgsString(args))
+        , m_sArgs(sArgs)
     {
     }
 
+    TraceEvent(std::map<OUString, OUString> aArgs)
+        : TraceEvent(createArgsString(aArgs))
+     {
+     }
+
 public:
     static void addInstantEvent(const char* sName, const std::map<OUString, 
OUString>& args
                                                    = std::map<OUString, 
OUString>());
@@ -105,9 +110,14 @@ class COMPHELPER_DLLPUBLIC NamedEvent : public TraceEvent
 protected:
     const char* m_sName;
 
-    NamedEvent(const char* sName,
-               const std::map<OUString, OUString>& args = std::map<OUString, 
OUString>())
-        : TraceEvent(args)
+    NamedEvent(const char* sName, const OUString& sArgs)
+        : TraceEvent(sArgs)
+        , m_sName(sName ? sName : "(null)")
+    {
+    }
+
+    NamedEvent(const char* sName, const std::map<OUString, OUString>& aArgs)
+        : TraceEvent(aArgs)
         , m_sName(sName ? sName : "(null)")
     {
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to