Bug 1455974 - Clear the client-side shared frame metrics data on shutdown with WR as well. r=sotaro
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 23 Apr 2018 14:24:36 -0400
changeset 468956 74de53b433e02ec12566704105d6ef7ba4d52df1
parent 468955 59f704125010863c16501f1d401112807f01e7b8
child 468957 c59d8689114017135c719817e7e585fbfe84a2ba
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1455974
milestone61.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 1455974 - Clear the client-side shared frame metrics data on shutdown with WR as well. r=sotaro There's some cleanup happening in CompositorBridgeChild to release the shared frame metrics when the client side is destroyed. However the code is specific to PLayerTransaction, and is missing for the WR codepath. This patch extracts the code to a helper and ensures that it runs for the WR equivalent codepath. MozReview-Commit-ID: ENJ349u0PTc
gfx/layers/ipc/CompositorBridgeChild.cpp
gfx/layers/ipc/CompositorBridgeChild.h
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -322,23 +322,17 @@ CompositorBridgeChild::AllocPLayerTransa
 
   return c;
 }
 
 bool
 CompositorBridgeChild::DeallocPLayerTransactionChild(PLayerTransactionChild* actor)
 {
   LayersId childId = static_cast<LayerTransactionChild*>(actor)->GetId();
-
-  for (auto iter = mFrameMetricsTable.Iter(); !iter.Done(); iter.Next()) {
-    nsAutoPtr<SharedFrameMetricsData>& data = iter.Data();
-    if (data->GetLayersId() == childId) {
-      iter.Remove();
-    }
-  }
+  ClearSharedFrameMetricsData(childId);
   static_cast<LayerTransactionChild*>(actor)->ReleaseIPDLReference();
   return true;
 }
 
 mozilla::ipc::IPCResult
 CompositorBridgeChild::RecvInvalidateLayers(const LayersId& aLayersId)
 {
   if (mLayerManager) {
@@ -1106,20 +1100,32 @@ CompositorBridgeChild::AllocPWebRenderBr
   child->AddIPDLReference();
   return child;
 }
 
 bool
 CompositorBridgeChild::DeallocPWebRenderBridgeChild(PWebRenderBridgeChild* aActor)
 {
   WebRenderBridgeChild* child = static_cast<WebRenderBridgeChild*>(aActor);
+  ClearSharedFrameMetricsData(wr::AsLayersId(child->GetPipeline()));
   child->ReleaseIPDLReference();
   return true;
 }
 
+void
+CompositorBridgeChild::ClearSharedFrameMetricsData(LayersId aLayersId)
+{
+  for (auto iter = mFrameMetricsTable.Iter(); !iter.Done(); iter.Next()) {
+    nsAutoPtr<SharedFrameMetricsData>& data = iter.Data();
+    if (data->GetLayersId() == aLayersId) {
+      iter.Remove();
+    }
+  }
+}
+
 uint64_t
 CompositorBridgeChild::GetNextResourceId()
 {
   ++mResourceId;
   MOZ_RELEASE_ASSERT(mResourceId != UINT32_MAX);
 
   uint64_t id = mIdNamespace;
   id = (id << 32) | mResourceId;
--- a/gfx/layers/ipc/CompositorBridgeChild.h
+++ b/gfx/layers/ipc/CompositorBridgeChild.h
@@ -319,16 +319,18 @@ private:
                                                  const uint64_t& aEpoch,
                                                  const bool& aActive) override;
 
   virtual mozilla::ipc::IPCResult
   RecvNotifyWebRenderError(const WebRenderError& aError) override;
 
   uint64_t GetNextResourceId();
 
+  void ClearSharedFrameMetricsData(LayersId aLayersId);
+
   // Class used to store the shared FrameMetrics, mutex, and APZCId  in a hash table
   class SharedFrameMetricsData {
   public:
     SharedFrameMetricsData(
         const mozilla::ipc::SharedMemoryBasic::Handle& metrics,
         const CrossProcessMutexHandle& handle,
         const LayersId& aLayersId,
         const uint32_t& aAPZCId);