summaryrefslogtreecommitdiffstats
path: root/dom/performance/PerformanceObserver.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/PerformanceObserver.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/PerformanceObserver.cpp')
-rw-r--r--dom/performance/PerformanceObserver.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/dom/performance/PerformanceObserver.cpp b/dom/performance/PerformanceObserver.cpp
index 11dd30ac2..d02acfb09 100644
--- a/dom/performance/PerformanceObserver.cpp
+++ b/dom/performance/PerformanceObserver.cpp
@@ -114,12 +114,13 @@ PerformanceObserver::Notify()
RefPtr<PerformanceObserverEntryList> list =
new PerformanceObserverEntryList(this, mQueuedEntries);
+ mQueuedEntries.Clear();
+
ErrorResult rv;
mCallback->Call(this, *list, *this, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
}
- mQueuedEntries.Clear();
}
void
@@ -170,6 +171,17 @@ PerformanceObserver::Observe(const PerformanceObserverInit& aOptions,
mEntryTypes.SwapElements(validEntryTypes);
mPerformance->AddObserver(this);
+
+ if (aOptions.mBuffered) {
+ for (auto entryType : mEntryTypes) {
+ nsTArray<RefPtr<PerformanceEntry>> existingEntries;
+ mPerformance->GetEntriesByType(entryType, existingEntries);
+ if (!existingEntries.IsEmpty()) {
+ mQueuedEntries.AppendElements(existingEntries);
+ }
+ }
+ }
+
mConnected = true;
}