Bug 1426056. P2 - remove unused members. draft
authorJW Wang <jwwang@mozilla.com>
Thu, 07 Dec 2017 15:45:15 +0800
changeset 713281 24a97ff28e1b244eb37866769eb963b94922d7a7
parent 712930 18561df2afa39cf3eb66d22369f1872fbfdc92ad
child 713282 37ec9c60fe6311b1ed74a0e6f65979548df1d925
push id93611
push userjwwang@mozilla.com
push dateWed, 20 Dec 2017 02:48:06 +0000
bugs1426056
milestone59.0a1
Bug 1426056. P2 - remove unused members. MozReview-Commit-ID: 6CjxrFzutkP
dom/media/ChannelMediaResource.cpp
dom/media/ChannelMediaResource.h
dom/media/MediaCache.cpp
dom/media/MediaCache.h
--- a/dom/media/ChannelMediaResource.cpp
+++ b/dom/media/ChannelMediaResource.cpp
@@ -465,17 +465,16 @@ ChannelMediaResource::Open(nsIStreamList
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   mSharedInfo = new SharedInfo;
   mSharedInfo->mResources.AppendElement(this);
 
   mIsLiveStream = cl < 0;
-  MOZ_ASSERT(GetOffset() == 0, "Who set offset already?");
   mListener = new Listener(this, 0, ++mLoadID);
   *aStreamListener = mListener;
   NS_ADDREF(*aStreamListener);
   return NS_OK;
 }
 
 nsresult
 ChannelMediaResource::OpenChannel(int64_t aOffset)
@@ -836,22 +835,19 @@ ChannelMediaResource::Seek(int64_t aOffs
 
   if (aResume) {
     mSuspendAgent.Resume();
   }
 
   // Don't create a new channel if we are still suspended. The channel will
   // be recreated when we are resumed.
   if (mSuspendAgent.IsSuspended()) {
-    // Store the offset so we know where to seek when resumed.
-    mPendingSeekOffset = aOffset;
     return NS_OK;
   }
 
-  MOZ_DIAGNOSTIC_ASSERT(mPendingSeekOffset == -1);
   nsresult rv = RecreateChannel();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return OpenChannel(aOffset);
 }
 
 void
 ChannelMediaResource::CacheClientSeek(int64_t aOffset, bool aResume)
@@ -942,22 +938,16 @@ ChannelMediaResource::GetDownloadRate(bo
 }
 
 int64_t
 ChannelMediaResource::GetLength()
 {
   return mCacheStream.GetLength();
 }
 
-int64_t
-ChannelMediaResource::GetOffset() const
-{
-  return mCacheStream.GetOffset();
-}
-
 nsCString
 ChannelMediaResource::GetDebugInfo()
 {
   return NS_LITERAL_CSTRING("ChannelMediaResource: ") +
          mCacheStream.GetDebugInfo();
 }
 
 // ChannelSuspendAgent
--- a/dom/media/ChannelMediaResource.h
+++ b/dom/media/ChannelMediaResource.h
@@ -220,18 +220,16 @@ protected:
   nsresult RecreateChannel();
   // Add headers to HTTP request. Main thread only.
   nsresult SetupChannelHeaders(int64_t aOffset);
   // Closes the channel. Main thread only.
   void CloseChannel();
   // Update the principal for the resource. Main thread only.
   void UpdatePrincipal();
 
-  int64_t GetOffset() const;
-
   // Parses 'Content-Range' header and returns results via parameters.
   // Returns error if header is not available, values are not parse-able or
   // values are out of range.
   nsresult ParseContentRangeHeader(nsIHttpChannel * aHttpChan,
                                    int64_t& aRangeStart,
                                    int64_t& aRangeEnd,
                                    int64_t& aRangeTotal);
 
@@ -251,19 +249,16 @@ protected:
   // Main thread access only
   // True if Close() has been called.
   bool mClosed = false;
   // The last reported seekability state for the underlying channel
   bool mIsTransportSeekable = false;
   RefPtr<Listener> mListener;
   // A mono-increasing integer to uniquely identify the channel we are loading.
   uint32_t mLoadID = 0;
-  // Used by the cache to store the offset to seek to when we are resumed.
-  // -1 means no seek initiated by the cache is waiting.
-  int64_t mPendingSeekOffset = -1;
   bool mIsLiveStream = false;
 
   // Any thread access
   MediaCacheStream mCacheStream;
 
   ChannelSuspendAgent mSuspendAgent;
 };
 
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -2424,24 +2424,16 @@ int64_t
 MediaCacheStream::GetLength()
 {
   // TODO: Assert non-main thread.
   AutoLock lock(mMediaCache->Monitor());
   return mStreamLength;
 }
 
 int64_t
-MediaCacheStream::GetOffset() const
-{
-  // TODO: Assert non-main thread.
-  AutoLock lock(mMediaCache->Monitor());
-  return mChannelOffset;
-}
-
-int64_t
 MediaCacheStream::GetNextCachedData(int64_t aOffset)
 {
   MOZ_ASSERT(!NS_IsMainThread());
   AutoLock lock(mMediaCache->Monitor());
   return GetNextCachedDataInternal(lock, aOffset);
 }
 
 int64_t
--- a/dom/media/MediaCache.h
+++ b/dom/media/MediaCache.h
@@ -299,18 +299,16 @@ public:
   void Unpin();
   // See comments above for NotifyDataStarted about how the length
   // can vary over time. Returns -1 if no length is known. Returns the
   // reported length if we haven't got any better information. If
   // the stream ended normally we return the length we actually got.
   // If we've successfully read data beyond the originally reported length,
   // we return the end of the data we've read.
   int64_t GetLength();
-  // Return the offset where next channel data will write to. Main thread only.
-  int64_t GetOffset() const;
   // Returns the unique resource ID. Call only on the main thread or while
   // holding the media cache lock.
   int64_t GetResourceID() { return mResourceID; }
   // Returns the end of the bytes starting at the given offset
   // which are in cache.
   int64_t GetCachedDataEnd(int64_t aOffset);
   // Returns the offset of the first byte of cached data at or after aOffset,
   // or -1 if there is no such cached data.