summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2021-05-31 15:55:20 +0300
committerTor Lillqvist <tml@collabora.com>2021-06-09 16:52:15 +0200
commit0fa2bb31b53c2b9114480ab77e0db4e011691440 (patch)
tree32f3fb6b0eacbcecfbef1f77b93a60a7328de109 /include/comphelper
parent4b8ead440a6216e42596333b0837854c923e25a9 (diff)
Avoid empty std::map constructor
Change-Id: Ie1bc333409fb201d82dd2cff7597e281600f01db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116449 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116849 Tested-by: Jenkins
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/profilezone.hxx39
-rw-r--r--include/comphelper/traceevent.hxx20
2 files changed, 39 insertions, 20 deletions
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx
index babd11f5b93b..08e6a8b031e8 100644
--- a/include/comphelper/profilezone.hxx
+++ b/include/comphelper/profilezone.hxx
@@ -31,6 +31,24 @@ 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:
/**
* Starts measuring the cost of a C++ scope.
@@ -47,23 +65,14 @@ public:
* 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 6e614ec0552e..5e2502de72a1 100644
--- a/include/comphelper/traceevent.hxx
+++ b/include/comphelper/traceevent.hxx
@@ -82,9 +82,14 @@ 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))
{
}
@@ -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)")
{
}