Commit b8ec98fe by Courtney Goeltzenleuchter Committed by Commit Bot

Fix build issue with tracing enabled

Global destructors are no longer allowed, thus need to use NoDestructor template on static objects to build correctly. Bug: angleproject:3790 Change-Id: I54b81d21b40649cb014636c7ed147f2c8cab33df Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1744199Reviewed-by: 's avatarJames Darpinian <jdarpinian@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: James Darpinian <jdarpinian@chromium.org>
parent 54d51f32
......@@ -21,6 +21,7 @@
# include <android/log.h>
#endif
#include "anglebase/no_destructor.h"
#include "common/Optional.h"
#include "common/angleutils.h"
#include "common/system_utils.h"
......@@ -251,11 +252,11 @@ void Trace(LogSeverity severity, const char *message)
return;
}
# endif // defined(NDEBUG)
static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
if (file)
static angle::base::NoDestructor<std::ofstream> file(TRACE_OUTPUT_FILE, std::ofstream::app);
if (file->good())
{
file << LogSeverityName(severity) << ": " << str << std::endl;
file.flush();
*file << LogSeverityName(severity) << ": " << str << std::endl;
file->flush();
}
#endif // defined(ANGLE_ENABLE_DEBUG_TRACE)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment