fune/toolkit/components/perfmonitoring/PerformanceUtils.h
Andreas Farre 1b5787e10a Bug 1646505 - Fix about:performance for Fission. r=tarek
With fission it's not possible to use
nsPIDOMWindowOuter::GetInProcessTop and expect to find the top-level
window, since it might be in another process. Instead we use
BrowsingContext::Top. Another issue is that it's not possible to
traverse children by recursively calling GetTabSizes, instead we need
to use BrowsingContext traversal mechanics.

Memory reporting is a bit tricky, since now doc gropus belonging to a
cross process top level browsing context needs to report it's memory
usage and can't skip it, so this is also handled.

Differential Revision: https://phabricator.services.mozilla.com/D97312
2020-12-11 15:56:23 +00:00

36 lines
1.1 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef PerformanceUtils_h
#define PerformanceUtils_h
#include "mozilla/PerformanceTypes.h"
class nsPIDOMWindowOuter;
namespace mozilla {
namespace dom {
class BrowsingContext;
class DocGroup;
} // namespace dom
/**
* Returns an array of promises to asynchronously collect all performance
* info in the current process.
*/
nsTArray<RefPtr<PerformanceInfoPromise>> CollectPerformanceInfo();
/**
* Asynchronously collects memory info for a given window
*/
RefPtr<MemoryPromise> CollectMemoryInfo(
const RefPtr<dom::BrowsingContext>& aContext,
const RefPtr<AbstractThread>& aEventTarget);
RefPtr<MemoryPromise> CollectMemoryInfo(
const RefPtr<dom::DocGroup>& aDocGroup,
const RefPtr<AbstractThread>& aEventTarget);
} // namespace mozilla
#endif // PerformanceUtils_h