Bug 1348503 - Retrieve the FrameLayerBuilder pointer from the LayerManager when we need it. r=tnikkel, a=jcristau
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 13 Jun 2019 17:02:54 +0000
changeset 537093 4ae8f7ba99880f6693f5281c76dbb8e41bab11ff
parent 537092 af24c9d1390f50ef1e5eff3ade5fcc7ca633b440
child 537094 d996ccc0aa7eab043a8b926c3dffcd7d899530b6
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel, jcristau
bugs1348503
milestone68.0
Bug 1348503 - Retrieve the FrameLayerBuilder pointer from the LayerManager when we need it. r=tnikkel, a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D34772
layout/painting/FrameLayerBuilder.cpp
layout/painting/FrameLayerBuilder.h
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -3749,23 +3749,24 @@ UniquePtr<InactiveLayerData> PaintedLaye
     tempManager = aData->InactiveManager();
   }
   if (!tempManager) {
     tempManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
   }
   UniquePtr<InactiveLayerData> data = MakeUnique<InactiveLayerData>();
   data->mLayerManager = tempManager;
 
-  data->mLayerBuilder = new FrameLayerBuilder();
-  data->mLayerBuilder->Init(aState->Builder(), tempManager, this, true,
+  FrameLayerBuilder* layerBuilder = new FrameLayerBuilder();
+  // Ownership of layerBuilder is passed to tempManager.
+  layerBuilder->Init(aState->Builder(), tempManager, this, true,
                             &aItem->GetClip());
 
   tempManager->BeginTransaction();
   if (aState->LayerBuilder()->GetRetainingLayerManager()) {
-    data->mLayerBuilder->DidBeginRetainedLayerTransaction(tempManager);
+    layerBuilder->DidBeginRetainedLayerTransaction(tempManager);
   }
 
   data->mProps = LayerProperties::CloneFrom(tempManager->GetRoot());
   data->mLayer = aItem->BuildLayer(aState->Builder(), tempManager,
                                    ContainerLayerParameters());
   return data;
 }
 
@@ -5367,17 +5368,17 @@ void FrameLayerBuilder::AddPaintedDispla
 
     data->mOldTransform = data->mTransform;
     data->mTransform = aItem.mTransform;
   }
 
   if (aItem.mInactiveLayerData) {
     RefPtr<BasicLayerManager> tempManager =
         aItem.mInactiveLayerData->mLayerManager;
-    FrameLayerBuilder* layerBuilder = aItem.mInactiveLayerData->mLayerBuilder;
+    FrameLayerBuilder* layerBuilder = tempManager->GetLayerBuilder();
     Layer* tmpLayer = aItem.mInactiveLayerData->mLayer;
 
     // We have no easy way of detecting if this transaction will ever actually
     // get finished. For now, I've just silenced the warning with nested
     // transactions in BasicLayers.cpp
     if (!tmpLayer) {
       tempManager->EndTransaction(nullptr, nullptr);
       tempManager->SetUserData(&gLayerManagerLayerBuilder, nullptr);
--- a/layout/painting/FrameLayerBuilder.h
+++ b/layout/painting/FrameLayerBuilder.h
@@ -224,17 +224,16 @@ class RefCountedRegion {
 
   RefCountedRegion() : mIsInfinite(false) {}
   nsRegion mRegion;
   bool mIsInfinite;
 };
 
 struct InactiveLayerData {
   RefPtr<layers::BasicLayerManager> mLayerManager;
-  FrameLayerBuilder* mLayerBuilder;
   RefPtr<layers::Layer> mLayer;
   UniquePtr<layers::LayerProperties> mProps;
 
   ~InactiveLayerData();
 };
 
 struct AssignedDisplayItem {
   AssignedDisplayItem(nsPaintedDisplayItem* aItem, LayerState aLayerState,