Bug 1386918 - out-of-line LazyLogModule::operator LogModule*(); r=erahm

This function takes up quite a bit of space, and there's no need to for
the log getter to be inlined everywhere.  Moving this to out-of-line
code saves ~200K on x86-64 Linux.
This commit is contained in:
Nathan Froyd 2017-08-18 12:32:05 -04:00
Родитель 3d4fc5c8f4
Коммит 3f20e1f6cd
2 изменённых файлов: 16 добавлений и 14 удалений

Просмотреть файл

@ -42,6 +42,21 @@ const uint32_t kRotateFilesNumber = 4;
namespace mozilla {
LazyLogModule::operator LogModule*()
{
// NB: The use of an atomic makes the reading and assignment of mLog
// thread-safe. There is a small chance that mLog will be set more
// than once, but that's okay as it will be set to the same LogModule
// instance each time. Also note LogModule::Get is thread-safe.
LogModule* tmp = mLog;
if (MOZ_UNLIKELY(!tmp)) {
tmp = LogModule::Get(mLogName);
mLog = tmp;
}
return tmp;
}
namespace detail {
void log_print(const LogModule* aModule,

Просмотреть файл

@ -162,20 +162,7 @@ public:
{
}
operator LogModule*()
{
// NB: The use of an atomic makes the reading and assignment of mLog
// thread-safe. There is a small chance that mLog will be set more
// than once, but that's okay as it will be set to the same LogModule
// instance each time. Also note LogModule::Get is thread-safe.
LogModule* tmp = mLog;
if (MOZ_UNLIKELY(!tmp)) {
tmp = LogModule::Get(mLogName);
mLog = tmp;
}
return tmp;
}
operator LogModule*();
private:
const char* const mLogName;