Backed out changeset 87f6ee3f86c1 (bug 997367) for mochitest assertions on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 24 Apr 2014 10:40:35 +0200
changeset 180259 3dcee82b43f4c9e95e893c9a0467e431836c29bb
parent 180258 a26c8f53a22365985eabcf3b5120fbb26f11fd96
child 180260 25dd3d17a19aa712bb749278aafcacdd52e2bf70
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
bugs997367
milestone31.0a1
backs out87f6ee3f86c1d39423145d65a18524477de0f534
Backed out changeset 87f6ee3f86c1 (bug 997367) for mochitest assertions on a CLOSED TREE
gfx/layers/ipc/CompositorParent.cpp
gfx/layers/ipc/CompositorParent.h
layout/ipc/RenderFrameParent.cpp
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -974,21 +974,29 @@ CompositorParent::AllocateLayerTreeId()
 {
   MOZ_ASSERT(CompositorLoop());
   MOZ_ASSERT(NS_IsMainThread());
   static uint64_t ids = 0;
   return ++ids;
 }
 
 static void
-RemoveIndirectTree(uint64_t aId)
+EraseLayerState(uint64_t aId)
 {
   sIndirectLayerTrees.erase(aId);
 }
 
+/*static*/ void
+CompositorParent::DeallocateLayerTreeId(uint64_t aId)
+{
+  MOZ_ASSERT(NS_IsMainThread());
+  CompositorLoop()->PostTask(FROM_HERE,
+                             NewRunnableFunction(&EraseLayerState, aId));
+}
+
 static void
 UpdateControllerForLayersId(uint64_t aLayersId,
                             GeckoContentController* aController)
 {
   // Adopt ref given to us by SetControllerForLayerTree()
   sIndirectLayerTrees[aLayersId].mController =
     already_AddRefed<GeckoContentController>(aController);
 }
@@ -1172,16 +1180,22 @@ CompositorParent::GetIndirectShadowTree(
 {
   LayerTreeMap::const_iterator cit = sIndirectLayerTrees.find(aId);
   if (sIndirectLayerTrees.end() == cit) {
     return nullptr;
   }
   return &cit->second;
 }
 
+static void
+RemoveIndirectTree(uint64_t aId)
+{
+  sIndirectLayerTrees.erase(aId);
+}
+
 void
 CrossProcessCompositorParent::ActorDestroy(ActorDestroyReason aWhy)
 {
   MessageLoop::current()->PostTask(
     FROM_HERE,
     NewRunnableMethod(this, &CrossProcessCompositorParent::DeferredDestroy));
 }
 
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -159,16 +159,22 @@ public:
 
   /**
    * Allocate an ID that can be used to refer to a layer tree and
    * associated resources that live only on the compositor thread.
    *
    * Must run on the content main thread.
    */
   static uint64_t AllocateLayerTreeId();
+  /**
+   * Release compositor-thread resources referred to by |aID|.
+   *
+   * Must run on the content main thread.
+   */
+  static void DeallocateLayerTreeId(uint64_t aId);
 
   /**
    * Set aController as the pan/zoom callback for the subtree referred
    * to by aLayersId.
    *
    * Must run on content main thread.
    */
   static void SetControllerForLayerTree(uint64_t aLayersId,
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -937,16 +937,17 @@ RenderFrameParent::NotifyInputEvent(Widg
     GetApzcTreeManager()->ReceiveInputEvent(aEvent, aOutTargetGuid);
   }
 }
 
 void
 RenderFrameParent::ActorDestroy(ActorDestroyReason why)
 {
   if (mLayersId != 0) {
+    CompositorParent::DeallocateLayerTreeId(mLayersId);
     if (mContentController) {
       // Stop our content controller from requesting repaints of our
       // content.
       mContentController->ClearRenderFrame();
       // TODO: notify the compositor?
     }
   }