Bug 1373343 - Skip the parallel traversal when the presshell isn't active. r=heycam

I've verified with the profiler that we use the parallel traversal for
loading a foreground tab, but not for a tab opened with ctrl-click.

MozReview-Commit-ID: 2SiVDlLLyah
This commit is contained in:
Bobby Holley 2017-08-17 09:04:56 -07:00
Родитель 1a27a5a33d
Коммит 1b117f0519
1 изменённых файлов: 5 добавлений и 2 удалений

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

@ -878,7 +878,9 @@ ServoStyleSet::StyleDocument(ServoTraversalFlags aBaseFlags)
// Allow the parallel traversal, unless we're traversing traversing one of
// the native anonymous document style roots, which are tiny and not worth
// parallelizing over.
if (!root->IsInNativeAnonymousSubtree()) {
//
// We only allow the parallel traversal in active (foreground) tabs.
if (!root->IsInNativeAnonymousSubtree() && mPresContext->PresShell()->IsActive()) {
flags |= ServoTraversalFlags::ParallelTraversal;
}
@ -980,7 +982,8 @@ ServoStyleSet::StyleNewChildren(Element* aParent)
// styling with this API. Not clear how common that is, but we allow parallel
// traversals in this case to preserve the old behavior (where Servo would
// use the parallel traversal i.f.f. the traversal root was the document root).
if (aParent == aParent->OwnerDoc()->GetRootElement()) {
if (aParent == aParent->OwnerDoc()->GetRootElement() &&
mPresContext->PresShell()->IsActive()) {
flags |= ServoTraversalFlags::ParallelTraversal;
}