зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
3d4fc5c8f4
Коммит
3f20e1f6cd
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче