Bug 1449787 - Reduce indirection for static pointers in nsMediaFeature. r=emilio

The patch also changes sSystemMetrics to not refcount its elements, because
static atoms don't need refcounting.

MozReview-Commit-ID: 7uf7YjyNaZp

--HG--
extra : rebase_source : 210f2f24632c242e1d3fb129285717dafe0660d4
This commit is contained in:
Nicholas Nethercote 2018-04-26 13:28:26 +10:00
Родитель 3e5598a161
Коммит adaf03f650
1 изменённых файлов: 7 добавлений и 7 удалений

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

@ -25,19 +25,19 @@
using namespace mozilla;
static nsTArray<RefPtr<nsAtom>>* sSystemMetrics = nullptr;
static nsTArray<const nsStaticAtom*>* sSystemMetrics = nullptr;
#ifdef XP_WIN
struct OperatingSystemVersionInfo {
LookAndFeel::OperatingSystemVersion mId;
nsStaticAtom** mName;
nsStaticAtom* const mName;
};
// Os version identities used in the -moz-os-version media query.
const OperatingSystemVersionInfo kOsVersionStrings[] = {
{ LookAndFeel::eOperatingSystemVersion_Windows7, &nsGkAtoms::windows_win7 },
{ LookAndFeel::eOperatingSystemVersion_Windows8, &nsGkAtoms::windows_win8 },
{ LookAndFeel::eOperatingSystemVersion_Windows10, &nsGkAtoms::windows_win10 }
{ LookAndFeel::eOperatingSystemVersion_Windows7, nsGkAtoms::windows_win7 },
{ LookAndFeel::eOperatingSystemVersion_Windows8, nsGkAtoms::windows_win8 },
{ LookAndFeel::eOperatingSystemVersion_Windows10, nsGkAtoms::windows_win10 }
};
#endif
@ -244,7 +244,7 @@ Gecko_MediaFeatures_GetOperatingSystemVersion(nsIDocument* aDocument)
&metricResult))) {
for (const auto& osVersion : kOsVersionStrings) {
if (metricResult == osVersion.mId) {
return *osVersion.mName;
return osVersion.mName;
}
}
}
@ -307,7 +307,7 @@ nsMediaFeatures::InitSystemMetrics()
MOZ_ASSERT(NS_IsMainThread());
sSystemMetrics = new nsTArray<RefPtr<nsAtom>>;
sSystemMetrics = new nsTArray<const nsStaticAtom*>;
/***************************************************************************
* ANY METRICS ADDED HERE SHOULD ALSO BE ADDED AS MEDIA QUERIES BELOW *