Backed out changeset 7b326aa4930c (bug 1545416) for causing multiple perma failures. CLOSED TREE
authorRazvan Maries <rmaries@mozilla.com>
Tue, 23 Apr 2019 22:29:36 +0300
changeset 470550 0ce3633f8b80b9bcb69165f6ec4dc97f19fa8f0a
parent 470549 2b9ff41f9e37e572e8d3776c7446a8b5eca022ea
child 470551 f40a3485926cadae4bb326767a3ff5268a1814ec
child 470587 4b0811d7b8e1591d4e48a26bdb8666a1bc5ccf61
push id83820
push userrmaries@mozilla.com
push dateTue, 23 Apr 2019 19:31:27 +0000
treeherderautoland@0ce3633f8b80 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1545416
milestone68.0a1
backs out7b326aa4930cad966e0a01d2d3d3d585d35002e2
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
Backed out changeset 7b326aa4930c (bug 1545416) for causing multiple perma failures. CLOSED TREE
dom/media/ipc/IRemoteDecoderChild.h
dom/media/ipc/PRemoteDecoder.ipdl
dom/media/ipc/PVideoDecoder.ipdl
dom/media/ipc/RemoteDecoderChild.cpp
dom/media/ipc/RemoteDecoderChild.h
dom/media/ipc/RemoteDecoderParent.cpp
dom/media/ipc/RemoteMediaDataDecoder.cpp
dom/media/ipc/VideoDecoderChild.cpp
dom/media/ipc/VideoDecoderChild.h
dom/media/ipc/VideoDecoderParent.cpp
--- a/dom/media/ipc/IRemoteDecoderChild.h
+++ b/dom/media/ipc/IRemoteDecoderChild.h
@@ -2,34 +2,33 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef include_dom_media_ipc_IRemoteDecoderChild_h
 #define include_dom_media_ipc_IRemoteDecoderChild_h
 
 #include "PlatformDecoderModule.h"
-#include "mozilla/TaskQueue.h"
 
 namespace mozilla {
 
 // This interface mirrors the MediaDataDecoder plus a bit (DestroyIPDL)
 // to allow proxying to a remote decoder in RemoteDecoderModule or
 // GpuDecoderModule. RemoteAudioDecoderChild, RemoteVideoDecoderChild,
 // and VideoDecoderChild (for GPU) implement this interface.
 class IRemoteDecoderChild {
  public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IRemoteDecoderChild);
 
   virtual RefPtr<MediaDataDecoder::InitPromise> Init() = 0;
   virtual RefPtr<MediaDataDecoder::DecodePromise> Decode(
       MediaRawData* aSample) = 0;
   virtual RefPtr<MediaDataDecoder::DecodePromise> Drain() = 0;
   virtual RefPtr<MediaDataDecoder::FlushPromise> Flush() = 0;
-  virtual RefPtr<ShutdownPromise> Shutdown() = 0;
+  virtual void Shutdown() = 0;
   virtual bool IsHardwareAccelerated(nsACString& aFailureReason) const {
     return false;
   }
   virtual nsCString GetDescriptionName() const = 0;
   virtual void SetSeekThreshold(const media::TimeUnit& aTime) {}
   virtual MediaDataDecoder::ConversionRequired NeedsConversion() const {
     return MediaDataDecoder::ConversionRequired::kNeedNone;
   }
--- a/dom/media/ipc/PRemoteDecoder.ipdl
+++ b/dom/media/ipc/PRemoteDecoder.ipdl
@@ -60,17 +60,16 @@ parent:
 
 child:
   async InitComplete(TrackType trackType,
                      nsCString decoderDescription,
                      ConversionRequired conversion);
   async InitFailed(nsresult reason);
 
   async FlushComplete();
-  async ShutdownComplete();
 
   async Output(DecodedOutputIPDL data);
   async InputExhausted();
   async DrainComplete();
   async Error(nsresult error);
 };
 
 } // namespace mozilla
--- a/dom/media/ipc/PVideoDecoder.ipdl
+++ b/dom/media/ipc/PVideoDecoder.ipdl
@@ -40,17 +40,16 @@ parent:
 
   async __delete__();
 
 child:
   async InitComplete(nsCString decoderDescription, bool hardware, nsCString hardwareReason, uint32_t conversion);
   async InitFailed(nsresult reason);
 
   async FlushComplete();
-  async ShutdownComplete();
 
   // Each output includes a SurfaceDescriptorGPUVideo that represents the decoded
   // frame. This SurfaceDescriptor can be used on the Layers IPDL protocol, but
   // must be released explicitly using DeallocateSurfaceDescriptorGPUVideo
   // on the manager protocol.
   async Output(VideoDataIPDL data);
   async InputExhausted();
   async DrainComplete();
--- a/dom/media/ipc/RemoteDecoderChild.cpp
+++ b/dom/media/ipc/RemoteDecoderChild.cpp
@@ -32,17 +32,16 @@ mozilla::ipc::IPCResult RemoteDecoderChi
 }
 
 mozilla::ipc::IPCResult RemoteDecoderChild::RecvError(const nsresult& aError) {
   AssertOnManagerThread();
   mDecodedData = MediaDataDecoder::DecodedData();
   mDecodePromise.RejectIfExists(aError, __func__);
   mDrainPromise.RejectIfExists(aError, __func__);
   mFlushPromise.RejectIfExists(aError, __func__);
-  mShutdownPromise.RejectIfExists(false, __func__);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult RemoteDecoderChild::RecvInitComplete(
     const TrackInfo::TrackType& trackType, const nsCString& aDecoderDescription,
     const ConversionRequired& aConversion) {
   AssertOnManagerThread();
   mInitPromise.ResolveIfExists(trackType, __func__);
@@ -60,22 +59,16 @@ mozilla::ipc::IPCResult RemoteDecoderChi
 }
 
 mozilla::ipc::IPCResult RemoteDecoderChild::RecvFlushComplete() {
   AssertOnManagerThread();
   mFlushPromise.ResolveIfExists(true, __func__);
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult RemoteDecoderChild::RecvShutdownComplete() {
-  AssertOnManagerThread();
-  mShutdownPromise.ResolveIfExists(true, __func__);
-  return IPC_OK();
-}
-
 void RemoteDecoderChild::ActorDestroy(ActorDestroyReason aWhy) {
   mCanSend = false;
 }
 
 void RemoteDecoderChild::DestroyIPDL() {
   if (mCanSend) {
     PRemoteDecoderChild::Send__delete__(this);
   }
@@ -144,25 +137,23 @@ RefPtr<MediaDataDecoder::DecodePromise> 
   if (!mCanSend) {
     return MediaDataDecoder::DecodePromise::CreateAndReject(
         NS_ERROR_DOM_MEDIA_DECODE_ERR, __func__);
   }
   SendDrain();
   return mDrainPromise.Ensure(__func__);
 }
 
-RefPtr<ShutdownPromise> RemoteDecoderChild::Shutdown() {
+void RemoteDecoderChild::Shutdown() {
   AssertOnManagerThread();
   mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
-  if (!mCanSend) {
-    return ShutdownPromise::CreateAndReject(false, __func__);
+  if (mCanSend) {
+    SendShutdown();
   }
-  SendShutdown();
   mInitialized = false;
-  return mShutdownPromise.Ensure(__func__);
 }
 
 bool RemoteDecoderChild::IsHardwareAccelerated(
     nsACString& aFailureReason) const {
   AssertOnManagerThread();
   aFailureReason = mHardwareAcceleratedReason;
   return mIsHardwareAccelerated;
 }
--- a/dom/media/ipc/RemoteDecoderChild.h
+++ b/dom/media/ipc/RemoteDecoderChild.h
@@ -26,27 +26,26 @@ class RemoteDecoderChild : public PRemot
   IPCResult RecvInputExhausted();
   IPCResult RecvDrainComplete();
   IPCResult RecvError(const nsresult& aError);
   IPCResult RecvInitComplete(const TrackInfo::TrackType& trackType,
                              const nsCString& aDecoderDescription,
                              const ConversionRequired& aConversion);
   IPCResult RecvInitFailed(const nsresult& aReason);
   IPCResult RecvFlushComplete();
-  IPCResult RecvShutdownComplete();
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
   // IRemoteDecoderChild
   RefPtr<MediaDataDecoder::InitPromise> Init() override;
   RefPtr<MediaDataDecoder::DecodePromise> Decode(
       MediaRawData* aSample) override;
   RefPtr<MediaDataDecoder::DecodePromise> Drain() override;
   RefPtr<MediaDataDecoder::FlushPromise> Flush() override;
-  RefPtr<ShutdownPromise> Shutdown() override;
+  void Shutdown() override;
   bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
   nsCString GetDescriptionName() const override;
   void SetSeekThreshold(const media::TimeUnit& aTime) override;
   MediaDataDecoder::ConversionRequired NeedsConversion() const override;
   void DestroyIPDL() override;
 
   // Called from IPDL when our actor has been destroyed
   void IPDLActorDestroyed();
@@ -63,17 +62,16 @@ class RemoteDecoderChild : public PRemot
 
  private:
   RefPtr<nsIThread> mThread;
 
   MozPromiseHolder<MediaDataDecoder::InitPromise> mInitPromise;
   MozPromiseHolder<MediaDataDecoder::DecodePromise> mDecodePromise;
   MozPromiseHolder<MediaDataDecoder::DecodePromise> mDrainPromise;
   MozPromiseHolder<MediaDataDecoder::FlushPromise> mFlushPromise;
-  MozPromiseHolder<ShutdownPromise> mShutdownPromise;
 
   nsCString mHardwareAcceleratedReason;
   nsCString mDescription;
   bool mInitialized = false;
   bool mIsHardwareAccelerated = false;
   MediaDataDecoder::ConversionRequired mConversion =
       MediaDataDecoder::ConversionRequired::kNeedNone;
 };
--- a/dom/media/ipc/RemoteDecoderParent.cpp
+++ b/dom/media/ipc/RemoteDecoderParent.cpp
@@ -133,28 +133,17 @@ mozilla::ipc::IPCResult RemoteDecoderPar
       [self](const MediaResult& aError) { self->Error(aError); });
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult RemoteDecoderParent::RecvShutdown() {
   MOZ_ASSERT(!mDestroyed);
   MOZ_ASSERT(OnManagerThread());
   if (mDecoder) {
-    RefPtr<RemoteDecoderParent> self = this;
-    mDecoder->Shutdown()->Then(
-        mManagerTaskQueue, __func__,
-        [self](const ShutdownPromise::ResolveOrRejectValue& aValue) {
-          if (aValue.IsResolve()) {
-            if (!self->mDestroyed) {
-              Unused << self->SendShutdownComplete();
-            }
-          } else {
-            self->Error(NS_ERROR_DOM_MEDIA_DECODE_ERR);
-          }
-        });
+    mDecoder->Shutdown();
   }
   mDecoder = nullptr;
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult RemoteDecoderParent::RecvSetSeekThreshold(
     const TimeUnit& aTime) {
   MOZ_ASSERT(!mDestroyed);
@@ -162,28 +151,17 @@ mozilla::ipc::IPCResult RemoteDecoderPar
   mDecoder->SetSeekThreshold(aTime);
   return IPC_OK();
 }
 
 void RemoteDecoderParent::ActorDestroy(ActorDestroyReason aWhy) {
   MOZ_ASSERT(!mDestroyed);
   MOZ_ASSERT(OnManagerThread());
   if (mDecoder) {
-    RefPtr<RemoteDecoderParent> self = this;
-    mDecoder->Shutdown()->Then(
-        mManagerTaskQueue, __func__,
-        [self](const ShutdownPromise::ResolveOrRejectValue& aValue) {
-          if (aValue.IsResolve()) {
-            if (!self->mDestroyed) {
-              Unused << self->SendShutdownComplete();
-            }
-          } else {
-            self->Error(NS_ERROR_DOM_MEDIA_DECODE_ERR);
-          }
-        });
+    mDecoder->Shutdown();
     mDecoder = nullptr;
   }
 }
 
 void RemoteDecoderParent::Error(const MediaResult& aError) {
   MOZ_ASSERT(OnManagerThread());
   if (!mDestroyed) {
     Unused << SendError(aError);
--- a/dom/media/ipc/RemoteMediaDataDecoder.cpp
+++ b/dom/media/ipc/RemoteMediaDataDecoder.cpp
@@ -76,23 +76,20 @@ RefPtr<MediaDataDecoder::FlushPromise> R
 RefPtr<MediaDataDecoder::DecodePromise> RemoteMediaDataDecoder::Drain() {
   RefPtr<RemoteMediaDataDecoder> self = this;
   return InvokeAsync(mAbstractManagerThread, __func__,
                      [self]() { return self->mChild->Drain(); });
 }
 
 RefPtr<ShutdownPromise> RemoteMediaDataDecoder::Shutdown() {
   RefPtr<RemoteMediaDataDecoder> self = this;
-  return InvokeAsync(mAbstractManagerThread, __func__,
-                     [self]() { return self->mChild->Shutdown(); })
-      ->Then(mAbstractManagerThread, __func__,
-             [self](const ShutdownPromise::ResolveOrRejectValue& aValue) {
-               return ShutdownPromise::CreateAndResolveOrReject(aValue,
-                                                                __func__);
-             });
+  return InvokeAsync(mAbstractManagerThread, __func__, [self]() {
+    self->mChild->Shutdown();
+    return ShutdownPromise::CreateAndResolve(true, __func__);
+  });
 }
 
 bool RemoteMediaDataDecoder::IsHardwareAccelerated(
     nsACString& aFailureReason) const {
   aFailureReason = mHardwareAcceleratedReason;
   return mIsHardwareAccelerated;
 }
 
--- a/dom/media/ipc/VideoDecoderChild.cpp
+++ b/dom/media/ipc/VideoDecoderChild.cpp
@@ -110,22 +110,16 @@ mozilla::ipc::IPCResult VideoDecoderChil
 }
 
 mozilla::ipc::IPCResult VideoDecoderChild::RecvFlushComplete() {
   AssertOnManagerThread();
   mFlushPromise.ResolveIfExists(true, __func__);
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult VideoDecoderChild::RecvShutdownComplete() {
-  AssertOnManagerThread();
-  mShutdownPromise.ResolveIfExists(true, __func__);
-  return IPC_OK();
-}
-
 void VideoDecoderChild::ActorDestroy(ActorDestroyReason aWhy) {
   if (aWhy == AbnormalShutdown) {
     // GPU process crashed, record the time and send back to MFR for telemetry.
     mGPUCrashTime = TimeStamp::Now();
 
     // Defer reporting an error until we've recreated the manager so that
     // it'll be safe for MediaFormatReader to recreate decoders
     RefPtr<VideoDecoderChild> ref = this;
@@ -277,30 +271,23 @@ RefPtr<MediaDataDecoder::DecodePromise> 
     return MediaDataDecoder::DecodePromise::CreateAndReject(error, __func__);
   }
   if (mCanSend) {
     SendDrain();
   }
   return mDrainPromise.Ensure(__func__);
 }
 
-RefPtr<ShutdownPromise> VideoDecoderChild::Shutdown() {
+void VideoDecoderChild::Shutdown() {
   AssertOnManagerThread();
   mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
-  if (mNeedNewDecoder) {
-    MediaResult error(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER);
-    error.SetGPUCrashTimeStamp(mGPUCrashTime);
-    return ShutdownPromise::CreateAndReject(false, __func__);
+  if (mCanSend) {
+    SendShutdown();
   }
-  if (!mCanSend) {
-    return ShutdownPromise::CreateAndReject(false, __func__);
-  }
-  SendShutdown();
   mInitialized = false;
-  return mShutdownPromise.Ensure(__func__);
 }
 
 bool VideoDecoderChild::IsHardwareAccelerated(
     nsACString& aFailureReason) const {
   AssertOnManagerThread();
   aFailureReason = mHardwareAcceleratedReason;
   return mIsHardwareAccelerated;
 }
--- a/dom/media/ipc/VideoDecoderChild.h
+++ b/dom/media/ipc/VideoDecoderChild.h
@@ -31,26 +31,25 @@ class VideoDecoderChild final : public P
   IPCResult RecvDrainComplete();
   IPCResult RecvError(const nsresult& aError);
   IPCResult RecvInitComplete(const nsCString& aDecoderDescription,
                              const bool& aHardware,
                              const nsCString& aHardwareReason,
                              const uint32_t& aConversion);
   IPCResult RecvInitFailed(const nsresult& aReason);
   IPCResult RecvFlushComplete();
-  IPCResult RecvShutdownComplete();
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
   RefPtr<MediaDataDecoder::InitPromise> Init() override;
   RefPtr<MediaDataDecoder::DecodePromise> Decode(
       MediaRawData* aSample) override;
   RefPtr<MediaDataDecoder::DecodePromise> Drain() override;
   RefPtr<MediaDataDecoder::FlushPromise> Flush() override;
-  RefPtr<ShutdownPromise> Shutdown() override;
+  void Shutdown() override;
   bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
   nsCString GetDescriptionName() const override;
   void SetSeekThreshold(const media::TimeUnit& aTime) override;
   MediaDataDecoder::ConversionRequired NeedsConversion() const override;
   void DestroyIPDL() override;
 
   MOZ_IS_CLASS_INIT
   MediaResult InitIPDL(const VideoInfo& aVideoInfo, float aFramerate,
@@ -69,17 +68,16 @@ class VideoDecoderChild final : public P
 
   RefPtr<VideoDecoderChild> mIPDLSelfRef;
   RefPtr<nsIThread> mThread;
 
   MozPromiseHolder<MediaDataDecoder::InitPromise> mInitPromise;
   MozPromiseHolder<MediaDataDecoder::DecodePromise> mDecodePromise;
   MozPromiseHolder<MediaDataDecoder::DecodePromise> mDrainPromise;
   MozPromiseHolder<MediaDataDecoder::FlushPromise> mFlushPromise;
-  MozPromiseHolder<ShutdownPromise> mShutdownPromise;
 
   nsCString mHardwareAcceleratedReason;
   nsCString mDescription;
   bool mCanSend;
   bool mInitialized;
   bool mIsHardwareAccelerated;
   MediaDataDecoder::ConversionRequired mConversion;
 
--- a/dom/media/ipc/VideoDecoderParent.cpp
+++ b/dom/media/ipc/VideoDecoderParent.cpp
@@ -238,28 +238,17 @@ mozilla::ipc::IPCResult VideoDecoderPare
       [self](const MediaResult& aError) { self->Error(aError); });
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult VideoDecoderParent::RecvShutdown() {
   MOZ_ASSERT(!mDestroyed);
   MOZ_ASSERT(OnManagerThread());
   if (mDecoder) {
-    RefPtr<VideoDecoderParent> self = this;
-    mDecoder->Shutdown()->Then(
-        mManagerTaskQueue, __func__,
-        [self](const ShutdownPromise::ResolveOrRejectValue& aValue) {
-          if (aValue.IsResolve()) {
-            if (!self->mDestroyed) {
-              Unused << self->SendShutdownComplete();
-            }
-          } else {
-            self->Error(NS_ERROR_DOM_MEDIA_DECODE_ERR);
-          }
-        });
+    mDecoder->Shutdown();
   }
   mDecoder = nullptr;
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult VideoDecoderParent::RecvSetSeekThreshold(
     const TimeUnit& aTime) {
   MOZ_ASSERT(!mDestroyed);
@@ -267,30 +256,22 @@ mozilla::ipc::IPCResult VideoDecoderPare
   mDecoder->SetSeekThreshold(aTime);
   return IPC_OK();
 }
 
 void VideoDecoderParent::ActorDestroy(ActorDestroyReason aWhy) {
   MOZ_ASSERT(!mDestroyed);
   MOZ_ASSERT(OnManagerThread());
   if (mDecoder) {
-    RefPtr<VideoDecoderParent> self = this;
-    mDecoder->Shutdown()->Then(
-        mManagerTaskQueue, __func__,
-        [self](const ShutdownPromise::ResolveOrRejectValue& aValue) {
-          if (aValue.IsResolve()) {
-            if (!self->mDestroyed) {
-              Unused << self->SendShutdownComplete();
-            }
-          } else {
-            self->Error(NS_ERROR_DOM_MEDIA_DECODE_ERR);
-          }
-        });
+    mDecoder->Shutdown();
     mDecoder = nullptr;
   }
+  if (mDecodeTaskQueue) {
+    mDecodeTaskQueue->BeginShutdown();
+  }
 }
 
 void VideoDecoderParent::Error(const MediaResult& aError) {
   MOZ_ASSERT(OnManagerThread());
   if (!mDestroyed) {
     Unused << SendError(aError);
   }
 }