Bug 1597482 - Replace nsIDocShellTreeItem with BrowsingContext in GetProfileTimelineSubDocShells. r=mstange

`GetProfileTimelineSubDocShells` was using nsIDocShellTreeItem to walk the
DocShells that are visible and recording profile markers. This change switches
to using `BrowsingContext` for the walk, and ignores OOP iframes as they aren't
painting in the current process.

Differential Revision: https://phabricator.services.mozilla.com/D63960

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Steven MacLeod 2020-02-27 19:26:40 +00:00
Родитель d25deeb630
Коммит e2d402b50d
1 изменённых файлов: 10 добавлений и 12 удалений

Просмотреть файл

@ -1592,29 +1592,27 @@ static void GetProfileTimelineSubDocShells(nsDocShell* aRootDocShell,
return; return;
} }
nsTArray<RefPtr<nsIDocShell>> docShells; RefPtr<BrowsingContext> bc = aRootDocShell->GetBrowsingContext();
nsresult rv = aRootDocShell->GetAllDocShellsInSubtree( if (!bc) {
nsIDocShellTreeItem::typeAll, nsIDocShell::ENUMERATE_BACKWARDS,
docShells);
if (NS_FAILED(rv)) {
return; return;
} }
for (const auto& curItem : docShells) { bc->PostOrderWalk([&](BrowsingContext* aContext) {
if (!curItem->GetRecordProfileTimelineMarkers()) { nsDocShell* shell = nsDocShell::Cast(aContext->GetDocShell());
continue; if (!shell || !shell->GetRecordProfileTimelineMarkers()) {
// This process isn't painting OOP iframes so we ignore
// docshells that are OOP.
return;
} }
nsDocShell* shell = static_cast<nsDocShell*>(curItem.get());
bool isVisible = false; bool isVisible = false;
shell->GetVisibility(&isVisible); shell->GetVisibility(&isVisible);
if (!isVisible) { if (!isVisible) {
continue; return;
} }
aShells.AppendElement(shell); aShells.AppendElement(shell);
} });
} }
static void TakeFrameRequestCallbacksFrom( static void TakeFrameRequestCallbacksFrom(