зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1333183 - Prime the root element cache before the servo traversal. r=emilio
This commit is contained in:
Родитель
0f1312abd1
Коммит
6fac28059f
|
@ -4037,6 +4037,10 @@ nsIDocument::GetRootElement() const
|
|||
Element*
|
||||
nsDocument::GetRootElementInternal() const
|
||||
{
|
||||
// We invoke GetRootElement() immediately before the servo traversal, so we
|
||||
// should always have a cache hit from Servo.
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Loop backwards because any non-elements, such as doctypes and PIs
|
||||
// are likely to appear before the root element.
|
||||
uint32_t i;
|
||||
|
|
|
@ -192,6 +192,11 @@ ServoStyleSet::PrepareAndTraverseSubtree(RawGeckoElementBorrowed aRoot,
|
|||
mozilla::TraversalRootBehavior aRootBehavior) {
|
||||
ResolveMappedAttrDeclarationBlocks();
|
||||
|
||||
// Get the Document's root element to ensure that the cache is valid before
|
||||
// calling into the (potentially-parallel) Servo traversal, where a cache hit
|
||||
// is necessary to avoid a data race when updating the cache.
|
||||
mozilla::Unused << aRoot->OwnerDoc()->GetRootElement();
|
||||
|
||||
MOZ_ASSERT(!sInServoTraversal);
|
||||
sInServoTraversal = true;
|
||||
Servo_TraverseSubtree(aRoot, mRawSet.get(), aRootBehavior);
|
||||
|
|
Загрузка…
Ссылка в новой задаче