diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-22 04:25:34 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-22 04:25:34 +0200 |
commit | 733f8f1eb908a84d41b46bec94604460dba87479 (patch) | |
tree | 8b171b21ee5b3e44bdc6a945a0a16ff96ed056ac /dom/performance/PerformanceObserver.cpp | |
parent | fbb41fce6aa4f931d9bff687a90f89b0c35eb216 (diff) | |
download | uxp-733f8f1eb908a84d41b46bec94604460dba87479.tar.gz |
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.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/dom/performance/PerformanceObserver.cpp b/dom/performance/PerformanceObserver.cpp index 11dd30ac23..d02acfb09a 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; } |