Bug 1171647, part 1 - Define a new function to convert the mode to a string. r=njn

This commit is contained in:
Andrew McCreight 2015-06-06 14:44:19 -07:00
Родитель 2a29c287a6
Коммит 7cb7fe1ebd
1 изменённых файлов: 19 добавлений и 13 удалений

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

@ -370,6 +370,8 @@ public:
bool IsDarkMatterMode() const { return mMode == DarkMatter; }
bool IsCumulativeMode() const { return mMode == Cumulative; }
const char* ModeString() const;
const char* DMDEnvVar() const { return mDMDEnvVar; }
size_t SampleBelowSize() const { return mSampleBelowSize.mActual; }
@ -1498,6 +1500,22 @@ Options::BadArg(const char* aArg)
exit(1);
}
const char*
Options::ModeString() const
{
switch (mMode) {
case Live:
return "live";
case DarkMatter:
return "dark-matter";
case Cumulative:
return "cumulative";
default:
MOZ_ASSERT(false);
return "(unknown DMD mode)";
}
}
//---------------------------------------------------------------------------
// DMD start-up
//---------------------------------------------------------------------------
@ -1780,19 +1798,7 @@ AnalyzeImpl(UniquePtr<JSONWriteFunc> aWriter)
writer.NullProperty("dmdEnvVar");
}
const char* mode;
if (gOptions->IsLiveMode()) {
mode = "live";
} else if (gOptions->IsDarkMatterMode()) {
mode = "dark-matter";
} else if (gOptions->IsCumulativeMode()) {
mode = "cumulative";
} else {
MOZ_ASSERT(false);
mode = "(unknown DMD mode)";
}
writer.StringProperty("mode", mode);
writer.StringProperty("mode", gOptions->ModeString());
writer.IntProperty("sampleBelowSize", gOptions->SampleBelowSize());
}
writer.EndObject();