Bug 1388298 - Add an API to process all invalidations on the main thread. r=emilio
authorWei-Cheng Pan <wpan@mozilla.com>
Thu, 24 Aug 2017 15:36:48 +0800
changeset 426608 4142a9865b9214e9ffe0e74f85722ce792095046
parent 426607 ab66b090d902712e81064f5188b484800d132e40
child 426609 7aec8d3eaa72838f1d83767f46dcfcae8de510ff
child 426622 b564008830c4cacef0ccfb9d8232db0553d671d9
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1388298
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1388298 - Add an API to process all invalidations on the main thread. r=emilio MozReview-Commit-ID: I7rBwvPQykR
layout/base/ServoRestyleManager.cpp
layout/base/ServoRestyleManager.h
layout/style/ServoBindingList.h
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -1099,16 +1099,27 @@ ServoRestyleManager::DoProcessPendingRes
 
 void
 ServoRestyleManager::ProcessPendingRestyles()
 {
   DoProcessPendingRestyles(ServoTraversalFlags::Empty);
 }
 
 void
+ServoRestyleManager::ProcessAllPendingAttributeAndStateInvalidations()
+{
+  AutoTimelineMarker marker(mPresContext->GetDocShell(),
+                            "ProcessAllPendingAttributeAndStateInvalidations");
+  for (auto iter = mSnapshots.Iter(); !iter.Done(); iter.Next()) {
+    Servo_ProcessInvalidations(StyleSet()->RawSet(), iter.Key(), &mSnapshots);
+  }
+  ClearSnapshots();
+}
+
+void
 ServoRestyleManager::UpdateOnlyAnimationStyles()
 {
   // Bug 1365855: We also need to implement this for SMIL.
   bool doCSS = PresContext()->EffectCompositor()->HasPendingStyleUpdates();
   if (!doCSS) {
     return;
   }
 
--- a/layout/base/ServoRestyleManager.h
+++ b/layout/base/ServoRestyleManager.h
@@ -180,16 +180,17 @@ public:
                         nsRestyleHint aRestyleHint,
                         nsChangeHint aMinChangeHint);
   void PostRestyleEventForCSSRuleChanges();
   void RebuildAllStyleData(nsChangeHint aExtraHint,
                            nsRestyleHint aRestyleHint);
   void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
                                     nsRestyleHint aRestyleHint);
   void ProcessPendingRestyles();
+  void ProcessAllPendingAttributeAndStateInvalidations();
 
   /**
    * Performs a Servo animation-only traversal to compute style for all nodes
    * with the animation-only dirty bit in the document.
    *
    * This processes just the traversal for animation-only restyles and skips the
    * normal traversal for other restyles unrelated to animations.
    * This is used to bring throttled animations up-to-date such as when we need
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -619,14 +619,20 @@ SERVO_BINDING_FUNC(Servo_GetCustomProper
 SERVO_BINDING_FUNC(Servo_GetCustomPropertiesCount, uint32_t,
                    ServoStyleContextBorrowed computed_values)
 
 SERVO_BINDING_FUNC(Servo_GetCustomPropertyNameAt, bool,
                    ServoStyleContextBorrowed, uint32_t index,
                    nsAString* name)
 
 
+SERVO_BINDING_FUNC(Servo_ProcessInvalidations, void,
+                   RawServoStyleSetBorrowed set,
+                   RawGeckoElementBorrowed element,
+                   const mozilla::ServoElementSnapshotTable* snapshots)
+
+
 // AddRef / Release functions
 #define SERVO_ARC_TYPE(name_, type_)                                \
   SERVO_BINDING_FUNC(Servo_##name_##_AddRef, void, type_##Borrowed) \
   SERVO_BINDING_FUNC(Servo_##name_##_Release, void, type_##Borrowed)
 #include "mozilla/ServoArcTypeList.h"
 #undef SERVO_ARC_TYPE