/src/mozilla-central/toolkit/components/perfmonitoring/PerformanceUtils.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "nsThreadUtils.h" |
8 | | #include "mozilla/PerformanceUtils.h" |
9 | | #include "mozilla/dom/DocGroup.h" |
10 | | #include "mozilla/dom/TabChild.h" |
11 | | #include "mozilla/dom/WorkerDebugger.h" |
12 | | #include "mozilla/dom/WorkerDebuggerManager.h" |
13 | | |
14 | | using namespace mozilla; |
15 | | using namespace mozilla::dom; |
16 | | |
17 | | namespace mozilla { |
18 | | |
19 | | void |
20 | | CollectPerformanceInfo(nsTArray<PerformanceInfo>& aMetrics) |
21 | 0 | { |
22 | 0 | // collecting ReportPerformanceInfo from all DocGroup instances |
23 | 0 | LinkedList<TabGroup>* tabGroups = TabGroup::GetTabGroupList(); |
24 | 0 |
|
25 | 0 | // if GetTabGroupList() returns null, we don't have any tab group |
26 | 0 | if (tabGroups) { |
27 | 0 | for (TabGroup* tabGroup = tabGroups->getFirst(); tabGroup; |
28 | 0 | tabGroup = |
29 | 0 | static_cast<LinkedListElement<TabGroup>*>(tabGroup)->getNext()) { |
30 | 0 | for (auto iter = tabGroup->Iter(); !iter.Done(); iter.Next()) { |
31 | 0 | DocGroup* docGroup = iter.Get()->mDocGroup; |
32 | 0 | aMetrics.AppendElement(docGroup->ReportPerformanceInfo()); |
33 | 0 | } |
34 | 0 | } |
35 | 0 | } |
36 | 0 |
|
37 | 0 | // collecting ReportPerformanceInfo from all WorkerDebugger instances |
38 | 0 | RefPtr<mozilla::dom::WorkerDebuggerManager> wdm = WorkerDebuggerManager::GetOrCreate(); |
39 | 0 | if (NS_WARN_IF(!wdm)) { |
40 | 0 | return; |
41 | 0 | } |
42 | 0 | for (uint32_t i = 0; i < wdm->GetDebuggersLength(); i++) { |
43 | 0 | WorkerDebugger* debugger = wdm->GetDebuggerAt(i); |
44 | 0 | aMetrics.AppendElement(debugger->ReportPerformanceInfo()); |
45 | 0 | } |
46 | 0 | } |
47 | | |
48 | | } // namespace |