mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
moebius#157: The Performance Observer (improvements)
https://github.com/MoonchildProductions/moebius/pull/157
This commit is contained in:
parent
f2565dab54
commit
6a97ee9379
13 changed files with 107 additions and 150 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue