QmlDesigner: Move thread local variables inside function

Maybe  make them inline but I think that is not working nice with DLLs.

Change-Id: Ice220873bf4f9c87cb64cb3271aa1ca5cfb1dda2
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marco Bubke
2024-02-23 12:54:16 +01:00
parent de5598e70f
commit 2ba6b48df4
2 changed files with 17 additions and 14 deletions

View File

@@ -9,14 +9,11 @@
namespace QmlDesigner {
namespace {
thread_local NanotraceHR::StringViewCategory<projectStorageTracingStatus()> projectStorageCategory_{
"project storage"_t, Tracing::eventQueue(), projectStorageCategory};
}
NanotraceHR::StringViewCategory<projectStorageTracingStatus()> &projectStorageCategory()
{
thread_local NanotraceHR::StringViewCategory<projectStorageTracingStatus()>
projectStorageCategory_{"project storage"_t, Tracing::eventQueue(), projectStorageCategory};
return projectStorageCategory_;
}

View File

@@ -7,31 +7,37 @@ namespace QmlDesigner {
namespace Tracing {
namespace {
using TraceFile = NanotraceHR::TraceFile<tracingStatus()>;
TraceFile traceFile{"qml_designer.json"};
thread_local NanotraceHR::EventQueueData<NanotraceHR::StringViewTraceEvent, 10000, tracingStatus()>
stringViewEventQueueData(traceFile);
thread_local NanotraceHR::EventQueueData<NanotraceHR::StringViewWithStringArgumentsTraceEvent, 1000, tracingStatus()>
stringViewWithStringArgumentsEventQueueData(traceFile);
TraceFile &traceFile()
{
static TraceFile traceFile{"qml_designer.json"};
return traceFile;
}
} // namespace
EventQueue &eventQueue()
{
thread_local NanotraceHR::EventQueueData<NanotraceHR::StringViewTraceEvent, 10000, tracingStatus()>
stringViewEventQueueData(traceFile());
return stringViewEventQueueData;
}
EventQueueWithStringArguments &eventQueueWithStringArguments()
{
thread_local NanotraceHR::
EventQueueData<NanotraceHR::StringViewWithStringArgumentsTraceEvent, 1000, tracingStatus()>
stringViewWithStringArgumentsEventQueueData(traceFile());
return stringViewWithStringArgumentsEventQueueData;
}
StringEventQueue &stringEventQueue()
{
thread_local NanotraceHR::EventQueueData<NanotraceHR::StringTraceEvent, 1000, tracingStatus()> eventQueue(
traceFile);
traceFile());
return eventQueue;
}