зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1072903 - TraceLogger: Part 1: Remove static array and use function to retrieve the tracelogger text descriptions, r=bbouvier
This commit is contained in:
Родитель
02c48dcda5
Коммит
8a265f320a
|
@ -79,13 +79,19 @@ rdtsc(void)
|
||||||
|
|
||||||
TraceLogging traceLoggers;
|
TraceLogging traceLoggers;
|
||||||
|
|
||||||
static const char* const text[] =
|
static const char *
|
||||||
|
TLTextIdString(TraceLogger::TextId id)
|
||||||
{
|
{
|
||||||
"TraceLogger failed to process text",
|
switch (id) {
|
||||||
#define NAME(x) #x,
|
case TraceLogger::TL_Error:
|
||||||
|
return "TraceLogger failed to process text";
|
||||||
|
#define NAME(textId) case TraceLogger::textId: return #textId;
|
||||||
TRACELOGGER_TEXT_ID_LIST(NAME)
|
TRACELOGGER_TEXT_ID_LIST(NAME)
|
||||||
#undef NAME
|
#undef NAME
|
||||||
};
|
default:
|
||||||
|
MOZ_CRASH();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TraceLogger::TraceLogger()
|
TraceLogger::TraceLogger()
|
||||||
: enabled(0),
|
: enabled(0),
|
||||||
|
@ -155,7 +161,8 @@ TraceLogger::init(uint32_t loggerId)
|
||||||
|
|
||||||
// Eagerly create the default textIds, to match their Tracelogger::TextId.
|
// Eagerly create the default textIds, to match their Tracelogger::TextId.
|
||||||
for (uint32_t i = 0; i < LAST; i++) {
|
for (uint32_t i = 0; i < LAST; i++) {
|
||||||
mozilla::DebugOnly<uint32_t> textId = createTextId(text[i]);
|
TraceLogger::TextId id = TraceLogger::TextId(i);
|
||||||
|
mozilla::DebugOnly<uint32_t> textId = createTextId(TLTextIdString(id));
|
||||||
MOZ_ASSERT(textId == i);
|
MOZ_ASSERT(textId == i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,9 +810,10 @@ TraceLogging::lazyInit()
|
||||||
"Specific log items:\n"
|
"Specific log items:\n"
|
||||||
);
|
);
|
||||||
for (uint32_t i = 1; i < TraceLogger::LAST; i++) {
|
for (uint32_t i = 1; i < TraceLogger::LAST; i++) {
|
||||||
if (!TraceLogger::textIdIsToggable(i))
|
TraceLogger::TextId id = TraceLogger::TextId(i);
|
||||||
|
if (!TraceLogger::textIdIsToggable(id))
|
||||||
continue;
|
continue;
|
||||||
printf(" %s\n", text[i]);
|
printf(" %s\n", TLTextIdString(id));
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -813,8 +821,9 @@ TraceLogging::lazyInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 1; i < TraceLogger::LAST; i++) {
|
for (uint32_t i = 1; i < TraceLogger::LAST; i++) {
|
||||||
if (TraceLogger::textIdIsToggable(i))
|
TraceLogger::TextId id = TraceLogger::TextId(i);
|
||||||
enabledTextIds[i] = ContainsFlag(env, text[i]);
|
if (TraceLogger::textIdIsToggable(id))
|
||||||
|
enabledTextIds[i] = ContainsFlag(env, TLTextIdString(id));
|
||||||
else
|
else
|
||||||
enabledTextIds[i] = true;
|
enabledTextIds[i] = true;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче