mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 04:39:07 -10:00
This ChromeUtils API now returns a promise that gets resolved once all the data has been collected via IPDL and the main process. The existing notification design and its related XPCOM classes are removed. MozReview-Commit-ID: CYKukBOC8yh
43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "nsThreadUtils.h"
|
|
#include "mozilla/PerformanceUtils.h"
|
|
#include "mozilla/dom/DocGroup.h"
|
|
#include "mozilla/dom/TabChild.h"
|
|
#include "mozilla/dom/WorkerDebugger.h"
|
|
#include "mozilla/dom/WorkerDebuggerManager.h"
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::dom;
|
|
|
|
namespace mozilla {
|
|
|
|
void
|
|
CollectPerformanceInfo(nsTArray<PerformanceInfo>& aMetrics)
|
|
{
|
|
// collecting ReportPerformanceInfo from all DocGroup instances
|
|
for (const auto& tabChild : TabChild::GetAll()) {
|
|
TabGroup* tabGroup = tabChild->TabGroup();
|
|
for (auto iter = tabGroup->Iter(); !iter.Done(); iter.Next()) {
|
|
DocGroup* docGroup = iter.Get()->mDocGroup;
|
|
aMetrics.AppendElement(docGroup->ReportPerformanceInfo());
|
|
}
|
|
}
|
|
|
|
// collecting ReportPerformanceInfo from all WorkerDebugger instances
|
|
RefPtr<mozilla::dom::WorkerDebuggerManager> wdm = WorkerDebuggerManager::GetOrCreate();
|
|
if (NS_WARN_IF(!wdm)) {
|
|
return;
|
|
}
|
|
for (uint32_t i = 0; i < wdm->GetDebuggersLength(); i++) {
|
|
WorkerDebugger* debugger = wdm->GetDebuggerAt(i);
|
|
aMetrics.AppendElement(debugger->ReportPerformanceInfo());
|
|
}
|
|
}
|
|
|
|
} // namespace
|