Bug 1338446 Part 5 - Label runnable in Gecko_DropElementSnapshot by using SystemGroup.
This runnable is to delete object only, so using system group should be
fine.
MozReview-Commit-ID: 8uMxMO3yERG
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -36,16 +36,17 @@
#include "nsTArray.h"
#include "mozilla/EffectCompositor.h"
#include "mozilla/EventStates.h"
#include "mozilla/Keyframe.h"
#include "mozilla/ServoElementSnapshot.h"
#include "mozilla/ServoRestyleManager.h"
#include "mozilla/StyleAnimationValue.h"
+#include "mozilla/SystemGroup.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/LookAndFeel.h"
using namespace mozilla;
using namespace mozilla::dom;
@@ -339,17 +340,18 @@ void
Gecko_DropElementSnapshot(ServoElementSnapshotOwned aSnapshot)
{
// 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());
+ SystemGroup::Dispatch("Gecko_DropElementSnapshot", TaskCategory::Other,
+ task.forget());
} else {
delete aSnapshot;
}
}
RawServoDeclarationBlockStrongBorrowedOrNull
Gecko_GetStyleAttrDeclarationBlock(RawGeckoElementBorrowed aElement)
{