bug 1252687 - get rid of static nsStrings in PerformanceObserver.cpp r=bz

This commit is contained in:
Trevor Saunders 2016-03-01 18:13:10 -05:00
parent 8fc1f1f3e4
commit 966ec780b8

View File

@ -135,14 +135,14 @@ PerformanceObserver::QueueEntry(PerformanceEntry* aEntry)
mQueuedEntries.AppendElement(aEntry); mQueuedEntries.AppendElement(aEntry);
} }
static nsString sValidTypeNames[7] = { static const char16_t* sValidTypeNames[7] = {
NS_LITERAL_STRING("composite"), MOZ_UTF16("composite"),
NS_LITERAL_STRING("mark"), MOZ_UTF16("mark"),
NS_LITERAL_STRING("measure"), MOZ_UTF16("measure"),
NS_LITERAL_STRING("navigation"), MOZ_UTF16("navigation"),
NS_LITERAL_STRING("render"), MOZ_UTF16("render"),
NS_LITERAL_STRING("resource"), MOZ_UTF16("resource"),
NS_LITERAL_STRING("server") MOZ_UTF16("server")
}; };
void void
@ -156,7 +156,8 @@ PerformanceObserver::Observe(const PerformanceObserverInit& aOptions,
nsTArray<nsString> validEntryTypes; nsTArray<nsString> validEntryTypes;
for (const nsString& validTypeName : sValidTypeNames) { for (const char16_t* name : sValidTypeNames) {
nsDependentString validTypeName(name);
if (aOptions.mEntryTypes.Contains<nsString>(validTypeName) && if (aOptions.mEntryTypes.Contains<nsString>(validTypeName) &&
!validEntryTypes.Contains<nsString>(validTypeName)) { !validEntryTypes.Contains<nsString>(validTypeName)) {
validEntryTypes.AppendElement(validTypeName); validEntryTypes.AppendElement(validTypeName);