Bug 1323678 - Support off-main-thread snapshot destruction. r=heycam

This commit is contained in:
Bobby Holley 2017-01-04 15:05:54 -08:00
parent f3e4b665b7
commit 1c5b9be020
2 changed files with 13 additions and 5 deletions

View File

@ -78,7 +78,7 @@ load 325984-1.xhtml
load 325984-2.html
load 328944-1.xul
load 329900-1.html
skip-if(stylo) load 330015-1.html # bug 1323678
load 330015-1.html
load 331204-1.html
load 331679-1.xhtml
load 331679-2.xml
@ -182,7 +182,7 @@ load 393326-1.html
load 393326-2.html
load 393661-1.html
load 393801-1.html
skip-if(stylo) load 394014-1.html # bug 1323678
load 394014-1.html
load 394014-2.html
load 394150-1.xhtml
load 397011-1.xhtml

View File

@ -279,16 +279,24 @@ Gecko_CalcStyleDifference(nsStyleContext* aOldStyleContext,
ServoElementSnapshotOwned
Gecko_CreateElementSnapshot(RawGeckoElementBorrowed aElement)
{
MOZ_ASSERT(NS_IsMainThread());
return new ServoElementSnapshot(aElement);
}
void
Gecko_DropElementSnapshot(ServoElementSnapshotOwned aSnapshot)
{
MOZ_ASSERT(NS_IsMainThread(),
"ServoAttrSnapshots can only be dropped on the main thread");
// Proxy deletes have a lot of overhead, so Servo tries hard to only drop
// snapshots on the main thread. However, there are certain cases where
// it's unavoidable (i.e. synchronously dropping the style data for the
// descendants of a new display:none root).
if (MOZ_UNLIKELY(!NS_IsMainThread())) {
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([=]() { delete aSnapshot; });
NS_DispatchToMainThread(task.forget());
} else {
delete aSnapshot;
}
}
RawServoDeclarationBlockStrongBorrowedOrNull
Gecko_GetServoDeclarationBlock(RawGeckoElementBorrowed aElement)