Bug 1338446 Part 5 - Label runnable in Gecko_DropElementSnapshot by using SystemGroup. draft
authorTing-Yu Lin <tlin@mozilla.com>
Tue, 14 Mar 2017 21:34:57 +0800
changeset 501450 95994f0907e20d7dfbdf4aa92809f27a92d07d29
parent 501449 62879f361491d0f9714c47262f651b7a3ccd406e
child 501451 bbd422041ee512e771e88a164a8e5327c23185e7
push id49988
push userbmo:tlin@mozilla.com
push dateMon, 20 Mar 2017 10:12:33 +0000
bugs1338446
milestone55.0a1
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
layout/style/ServoBindings.cpp
--- 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)
 {