Bug 1502786 - Break cycle between PureOmxPlatformLayer and OmxDataDecoder r=jya
authorTakuro Ashie <ashie@clear-code.com>
Tue, 06 Nov 2018 02:56:36 +0000
changeset 444537 b4e4e74aa3ccb6673df2a4b62249706e5999fcd6
parent 444536 b765559ddc3a9d0b54f3665de95407799e58e317
child 444539 e160f0a60e4fc9cc6e77dd57644d74d4c6cc88dd
child 444588 b55684fba8a2d04c2b8942e292fe402ab5436b1a
push id34996
push userrgurzau@mozilla.com
push dateTue, 06 Nov 2018 09:53:23 +0000
treeherdermozilla-central@e160f0a60e4f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1502786
milestone65.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 1502786 - Break cycle between PureOmxPlatformLayer and OmxDataDecoder r=jya OmxDataDecoder, OmxPromiseLayer and PureOmxPlatformLayer consist circular reference by RefPtr, and no one sever the reference. As a result their refcount never decrease to 0. This commit sever it at PureOmxPlatformLayer::Shutdown() which is called by OmxDataDecoder. Differential Revision: https://phabricator.services.mozilla.com/D10028
dom/media/platforms/omx/PureOmxPlatformLayer.cpp
--- a/dom/media/platforms/omx/PureOmxPlatformLayer.cpp
+++ b/dom/media/platforms/omx/PureOmxPlatformLayer.cpp
@@ -111,19 +111,16 @@ PureOmxPlatformLayer::PureOmxPlatformLay
   , mImageContainer(aImageContainer)
 {
   LOG("");
 }
 
 PureOmxPlatformLayer::~PureOmxPlatformLayer()
 {
   LOG("");
-  if (mComponent) {
-    OMX_FreeHandle(mComponent);
-  }
 }
 
 OMX_ERRORTYPE
 PureOmxPlatformLayer::InitOmxToStateLoaded(const TrackInfo* aInfo)
 {
   LOG("");
 
   if (!aInfo) {
@@ -272,16 +269,22 @@ PureOmxPlatformLayer::SetParameter(OMX_I
                           aParamIndex,
                           aComponentParameterStructure);
 }
 
 nsresult
 PureOmxPlatformLayer::Shutdown()
 {
   LOG("");
+  if (mComponent) {
+    OMX_FreeHandle(mComponent);
+    mComponent = nullptr;
+  }
+  mPromiseLayer = nullptr;
+  mDataDecoder = nullptr;
   return NS_OK;
 }
 
 /* static */ OMX_ERRORTYPE
 PureOmxPlatformLayer::EventHandler(OMX_HANDLETYPE hComponent,
                                    OMX_PTR pAppData,
                                    OMX_EVENTTYPE eEventType,
                                    OMX_U32 nData1,