summaryrefslogtreecommitdiffstats
path: root/dom/performance/PerformanceObserverEntryList.cpp
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-22 04:25:34 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-22 04:25:34 +0200
commitbdb4ff581677ad1cd411b55a68c87534f9a64882 (patch)
tree8b171b21ee5b3e44bdc6a945a0a16ff96ed056ac /dom/performance/PerformanceObserverEntryList.cpp
parent0a744b1cfeecdd2487d9166792ac5234edc9ee6a (diff)
downloadUXP-bdb4ff581677ad1cd411b55a68c87534f9a64882.tar
UXP-bdb4ff581677ad1cd411b55a68c87534f9a64882.tar.gz
UXP-bdb4ff581677ad1cd411b55a68c87534f9a64882.tar.lz
UXP-bdb4ff581677ad1cd411b55a68c87534f9a64882.tar.xz
UXP-bdb4ff581677ad1cd411b55a68c87534f9a64882.zip
moebius#157: The Performance Observer (improvements)
https://github.com/MoonchildProductions/moebius/pull/157
Diffstat (limited to 'dom/performance/PerformanceObserverEntryList.cpp')
-rw-r--r--dom/performance/PerformanceObserverEntryList.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/dom/performance/PerformanceObserverEntryList.cpp b/dom/performance/PerformanceObserverEntryList.cpp
index 349103f08..20e818f3d 100644
--- a/dom/performance/PerformanceObserverEntryList.cpp
+++ b/dom/performance/PerformanceObserverEntryList.cpp
@@ -66,6 +66,7 @@ PerformanceObserverEntryList::GetEntries(
aRetval.AppendElement(entry);
}
+ aRetval.Sort(PerformanceEntryComparator());
}
void
@@ -79,6 +80,7 @@ PerformanceObserverEntryList::GetEntriesByType(
aRetval.AppendElement(entry);
}
}
+ aRetval.Sort(PerformanceEntryComparator());
}
void
@@ -88,9 +90,18 @@ PerformanceObserverEntryList::GetEntriesByName(
nsTArray<RefPtr<PerformanceEntry>>& aRetval)
{
aRetval.Clear();
+ const bool typePassed = aEntryType.WasPassed();
for (const RefPtr<PerformanceEntry>& entry : mEntries) {
- if (entry->GetName().Equals(aName)) {
- aRetval.AppendElement(entry);
+ if (!entry->GetName().Equals(aName)) {
+ continue;
}
+
+ if (typePassed &&
+ !entry->GetEntryType().Equals(aEntryType.Value())) {
+ continue;
+ }
+
+ aRetval.AppendElement(entry);
}
+ aRetval.Sort(PerformanceEntryComparator());
}