Bug 1381758 - Remove the debug code added in bug 1326294. draft
authorJW Wang <jwwang@mozilla.com>
Tue, 18 Jul 2017 16:36:01 +0800
changeset 610373 2e9ce7b000b7c94b7549831a6228f7a85edcf4c1
parent 610234 5e73b9798464c3f7106f0161dc9a49b234f42f9c
child 637856 bd8ecec7984e852e75b485799f4de316bd4593b0
push id68886
push userjwwang@mozilla.com
push dateTue, 18 Jul 2017 09:01:06 +0000
bugs1381758, 1326294
milestone56.0a1
Bug 1381758 - Remove the debug code added in bug 1326294. Bug 1326294 is fixed and we don't need the debug code anymore. This help reduce the coupling with HTMLMediaElement and make MediaDecoder easier to be reused by Servo. MozReview-Commit-ID: KCwAjoQFPkS
dom/media/MediaDecoder.cpp
dom/media/MediaDecoder.h
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -17,21 +17,21 @@
 #include "mozilla/AbstractThread.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/AudioTrack.h"
 #include "mozilla/dom/AudioTrackList.h"
-#include "mozilla/dom/HTMLMediaElement.h"
 #include "mozilla/dom/VideoTrack.h"
 #include "mozilla/dom/VideoTrackList.h"
 #include "mozilla/layers/ShadowLayers.h"
 #include "nsComponentManagerUtils.h"
+#include "nsContentUtils.h"
 #include "nsError.h"
 #include "nsIMemoryReporter.h"
 #include "nsIObserver.h"
 #include "nsPrintfCString.h"
 #include "nsTArray.h"
 #include <algorithm>
 #include <limits>
 
@@ -253,18 +253,16 @@ MediaDecoder::MediaDecoder(MediaDecoderI
   , INIT_CANONICAL(mNextState, PLAY_STATE_PAUSED)
   , INIT_CANONICAL(mLogicallySeeking, false)
   , INIT_CANONICAL(mSameOriginMedia, false)
   , INIT_CANONICAL(mMediaPrincipalHandle, PRINCIPAL_HANDLE_NONE)
   , INIT_CANONICAL(mPlaybackBytesPerSecond, 0.0)
   , INIT_CANONICAL(mPlaybackRateReliable, true)
   , INIT_CANONICAL(mDecoderPosition, 0)
   , mTelemetryReported(false)
-  , mIsMediaElement(!!mOwner->GetMediaElement())
-  , mElement(mOwner->GetMediaElement())
   , mContainerType(aInit.mContainerType)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mAbstractMainThread);
   MediaMemoryTracker::AddMediaDecoder(this);
 
   //
   // Initialize watchers.
@@ -1553,18 +1551,16 @@ MediaMemoryTracker::CollectReports(nsIHa
 
   return NS_OK;
 }
 
 MediaDecoderOwner*
 MediaDecoder::GetOwner() const
 {
   MOZ_ASSERT(NS_IsMainThread());
-  // Check object lifetime when mOwner points to a media element.
-  MOZ_DIAGNOSTIC_ASSERT(!mOwner || !mIsMediaElement || mElement);
   // mOwner is valid until shutdown.
   return mOwner;
 }
 
 MediaDecoderOwner::NextFrameStatus
 MediaDecoder::NextFrameBufferedStatus()
 {
   MOZ_ASSERT(NS_IsMainThread());
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -30,20 +30,16 @@
 #include "nsIObserver.h"
 #include "nsISupports.h"
 #include "nsITimer.h"
 
 class nsIPrincipal;
 
 namespace mozilla {
 
-namespace dom {
-class HTMLMediaElement;
-}
-
 class AbstractThread;
 class VideoFrameContainer;
 class MediaDecoderReader;
 class MediaDecoderStateMachine;
 
 enum class MediaEventType : int8_t;
 enum class Visibility : uint8_t;
 
@@ -818,18 +814,14 @@ public:
     return &mDecoderPosition;
   }
 
 private:
   // Notify owner when the audible state changed
   void NotifyAudibleStateChanged();
 
   bool mTelemetryReported;
-
-  // Used to debug how mOwner becomes a dangling pointer in bug 1326294.
-  bool mIsMediaElement;
-  WeakPtr<dom::HTMLMediaElement> mElement;
   const MediaContainerType mContainerType;
 };
 
 } // namespace mozilla
 
 #endif