Bug 1397375 - Part3. Remove the related webrender user data when destroying a frame. r=jrmuizel
authorEthan Lin <ethlin@mozilla.com>
Thu, 14 Sep 2017 14:40:31 +0800
changeset 431366 3923dbb0879491c11f2c727b24a0c7f605c7d550
parent 431365 6b4ff36ca8a685c4dbbce4527b191149283e25c3
child 431367 0c3c45645636f8b9a5f2d850a533cc97512b69cf
push id7782
push userryanvm@gmail.com
push dateWed, 20 Sep 2017 11:51:24 +0000
treeherdermozilla-beta@4bfb0b8fb6b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1397375
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 1397375 - Part3. Remove the related webrender user data when destroying a frame. r=jrmuizel MozReview-Commit-ID: IYjfqWiiPZ
layout/generic/nsFrame.cpp
layout/generic/nsIFrame.h
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -10478,16 +10478,25 @@ nsIFrame::DestroyContentArray(ContentArr
 {
   for (nsIContent* content : *aArray) {
     content->UnbindFromTree();
     NS_RELEASE(content);
   }
   delete aArray;
 }
 
+/*static*/ void
+nsIFrame::DestroyWebRenderUserDataTable(WebRenderUserDataTable* aTable)
+{
+  for (auto iter = aTable->Iter(); !iter.Done(); iter.Next()) {
+    iter.UserData()->RemoveFromTable();
+  }
+  delete aTable;
+}
+
 bool
 nsIFrame::IsPseudoStackingContextFromStyle() {
   // If you change this, also change the computation of pseudoStackingContext
   // in BuildDisplayListForChild()
   if (StyleEffects()->mOpacity != 1.0f) {
     return true;
   }
   const nsStyleDisplay* disp = StyleDisplay();
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -1228,17 +1228,19 @@ public:
   NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(BBaselinePadProperty, nscoord)
 
   NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(GenConProperty, ContentArray,
                                       DestroyContentArray)
 
   NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(BidiDataProperty, mozilla::FrameBidiData)
 
   NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(PlaceholderFrameProperty, nsPlaceholderFrame)
-  NS_DECLARE_FRAME_PROPERTY_DELETABLE(WebRenderUserDataProperty, WebRenderUserDataTable)
+  NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(WebRenderUserDataProperty, WebRenderUserDataTable, DestroyWebRenderUserDataTable)
+
+  static void DestroyWebRenderUserDataTable(WebRenderUserDataTable* aTable);
 
   mozilla::FrameBidiData GetBidiData() const
   {
     bool exists;
     mozilla::FrameBidiData bidiData = GetProperty(BidiDataProperty(), &exists);
     if (!exists) {
       bidiData.precedingControl = mozilla::kBidiLevelNone;
     }