Bug 1420016 - remove ChannelMediaResource::IsSuspendedByCache(). r=bechen,gerald
authorJW Wang <jwwang@mozilla.com>
Thu, 23 Nov 2017 11:30:07 +0800
changeset 393796 1fb9066a67c910e1476c12d05094a69acdb8372e
parent 393795 7358a7b7676ba2d0081db032738d193a2214114b
child 393797 a612dc93c5989ea0d12123b721940312f7a04cfc
push id97735
push userebalazs@mozilla.com
push dateMon, 27 Nov 2017 22:11:10 +0000
treeherdermozilla-inbound@4b1257fe22a2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbechen, gerald
bugs1420016
milestone59.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 1420016 - remove ChannelMediaResource::IsSuspendedByCache(). r=bechen,gerald For it is used internally by CacheClientNotifySuspendedStatusChanged() only. MozReview-Commit-ID: 8XVUHhdERYR
dom/media/ChannelMediaResource.cpp
dom/media/ChannelMediaResource.h
dom/media/MediaCache.cpp
--- a/dom/media/ChannelMediaResource.cpp
+++ b/dom/media/ChannelMediaResource.cpp
@@ -844,23 +844,23 @@ ChannelMediaResource::UpdatePrincipal()
   nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
   if (secMan) {
     secMan->GetChannelResultPrincipal(mChannel, getter_AddRefs(principal));
     mCacheStream.UpdatePrincipal(principal);
   }
 }
 
 void
-ChannelMediaResource::CacheClientNotifySuspendedStatusChanged()
+ChannelMediaResource::CacheClientNotifySuspendedStatusChanged(bool aSuspended)
 {
   mCallback->AbstractMainThread()->Dispatch(NewRunnableMethod<bool>(
     "MediaResourceCallback::NotifySuspendedStatusChanged",
     mCallback.get(),
     &MediaResourceCallback::NotifySuspendedStatusChanged,
-    IsSuspendedByCache()));
+    aSuspended));
 }
 
 nsresult
 ChannelMediaResource::Seek(int64_t aOffset, bool aResume)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mClosed) {
@@ -939,22 +939,16 @@ ChannelMediaResource::GetCachedDataEnd(i
 
 bool
 ChannelMediaResource::IsDataCachedToEndOfResource(int64_t aOffset)
 {
   return mCacheStream.IsDataCachedToEndOfStream(aOffset);
 }
 
 bool
-ChannelMediaResource::IsSuspendedByCache()
-{
-  return mCacheStream.AreAllStreamsForResourceSuspended();
-}
-
-bool
 ChannelMediaResource::IsSuspended()
 {
   return mSuspendAgent.IsSuspended();
 }
 
 void
 ChannelMediaResource::SetReadMode(MediaCacheStream::ReadMode aMode)
 {
--- a/dom/media/ChannelMediaResource.h
+++ b/dom/media/ChannelMediaResource.h
@@ -83,17 +83,17 @@ public:
   void CacheClientNotifyDataReceived();
   // Notify that we reached the end of the stream. This can happen even
   // if this stream didn't read any data, since another stream might have
   // received data for the same resource.
   void CacheClientNotifyDataEnded(nsresult aStatus);
   // Notify that the principal for the cached resource changed.
   void CacheClientNotifyPrincipalChanged();
   // Notify the decoder that the cache suspended status changed.
-  void CacheClientNotifySuspendedStatusChanged();
+  void CacheClientNotifySuspendedStatusChanged(bool aSuspended);
 
   // These are called on the main thread by MediaCache. These shouldn't block,
   // but they may grab locks --- the media cache is not holding its lock
   // when these are called.
   // Start a new load at the given aOffset. The old load is cancelled
   // and no more data from the old load will be notified via
   // MediaCacheStream::NotifyDataReceived/Ended.
   void CacheClientSeek(int64_t aOffset, bool aResume);
@@ -187,17 +187,16 @@ public:
   };
   friend class Listener;
 
   nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override;
 
 protected:
   nsresult Seek(int64_t aOffset, bool aResume);
 
-  bool IsSuspendedByCache();
   // These are called on the main thread by Listener.
   nsresult OnStartRequest(nsIRequest* aRequest, int64_t aRequestOffset);
   nsresult OnStopRequest(nsIRequest* aRequest, nsresult aStatus);
   nsresult OnDataAvailable(uint32_t aLoadID,
                            nsIInputStream* aStream,
                            uint32_t aCount);
   nsresult OnChannelRedirect(nsIChannel* aOld,
                              nsIChannel* aNew,
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -1546,17 +1546,18 @@ MediaCache::Update()
         break;
     }
   }
 
   // Notify streams about the suspended status changes.
   for (uint32_t i = 0; i < mSuspendedStatusToNotify.Length(); ++i) {
     MediaCache::ResourceStreamIterator iter(this, mSuspendedStatusToNotify[i]);
     while (MediaCacheStream* stream = iter.Next()) {
-      stream->mClient->CacheClientNotifySuspendedStatusChanged();
+      stream->mClient->CacheClientNotifySuspendedStatusChanged(
+        stream->AreAllStreamsForResourceSuspended());
     }
   }
   mSuspendedStatusToNotify.Clear();
 }
 
 class UpdateEvent : public Runnable
 {
 public: