Bug 1418918. P1 - remove unused FlushPartialBlock(). draft
authorJW Wang <jwwang@mozilla.com>
Mon, 20 Nov 2017 16:00:22 +0800
changeset 703558 bfe3ac4738ae5b1d283ec124e72be6cdd891fc10
parent 703557 edcb78903d124316dffe6bfc0d047045672a768d
child 703559 9b78c00c938f4411a7e3895be843a491e4bfce4a
push id90857
push userjwwang@mozilla.com
push dateMon, 27 Nov 2017 02:57:51 +0000
bugs1418918
milestone59.0a1
Bug 1418918. P1 - remove unused FlushPartialBlock(). MozReview-Commit-ID: GSda1KfPWXE
dom/media/MediaCache.cpp
dom/media/MediaCache.h
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -2129,32 +2129,16 @@ MediaCacheStream::FlushPartialBlockInter
   // that will never come.
   if ((blockOffset > 0 || mChannelOffset == 0) && aNotifyAll) {
     // Wake up readers who may be waiting for this data
     aReentrantMonitor.NotifyAll();
   }
 }
 
 void
-MediaCacheStream::FlushPartialBlock()
-{
-  NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
-
-  ReentrantMonitorAutoEnter mon(mMediaCache->GetReentrantMonitor());
-
-  // Write the current partial block to memory.
-  // Note: This writes a full block, so if data is not at the end of the
-  // stream, the decoder must subsequently choose correct start and end offsets
-  // for reading/seeking.
-  FlushPartialBlockInternal(false, mon);
-
-  mMediaCache->QueueUpdate();
-}
-
-void
 MediaCacheStream::NotifyDataEndedInternal(uint32_t aLoadID,
                                           nsresult aStatus,
                                           bool aReopenOnError)
 {
   ReentrantMonitorAutoEnter mon(mMediaCache->GetReentrantMonitor());
 
   if (mClosed || aLoadID != mLoadID) {
     // Nothing to do if the stream is closed or a new load has begun.
--- a/dom/media/MediaCache.h
+++ b/dom/media/MediaCache.h
@@ -264,19 +264,16 @@ public:
   // Notifies the cache that data has been received. The stream already
   // knows the offset because data is received in sequence and
   // the starting offset is known via NotifyDataStarted or because
   // the cache requested the offset in
   // ChannelMediaResource::CacheClientSeek, or because it defaulted to 0.
   void NotifyDataReceived(uint32_t aLoadID,
                           uint32_t aCount,
                           const uint8_t* aData);
-  // Notifies the cache that the current bytes should be written to disk.
-  // Called on the main thread.
-  void FlushPartialBlock();
 
   // Set the load ID so the following NotifyDataEnded() call can work properly.
   // Used in some rare cases where NotifyDataEnded() is called without the
   // preceding NotifyDataStarted().
   void NotifyLoadID(uint32_t aLoadID);
 
   // Notifies the cache that the channel has closed with the given status.
   void NotifyDataEnded(uint32_t aLoadID,
@@ -443,18 +440,17 @@ private:
   // This method assumes that the cache monitor is held and can be called on
   // any thread.
   int64_t GetCachedDataEndInternal(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.
   // This method assumes that the cache monitor is held and can be called on
   // any thread.
   int64_t GetNextCachedDataInternal(int64_t aOffset);
-  // Writes |mPartialBlock| to disk.
-  // Used by |NotifyDataEnded| and |FlushPartialBlock|.
+  // Used by |NotifyDataEnded| to write |mPartialBlock| to disk.
   // If |aNotifyAll| is true, this function will wake up readers who may be
   // waiting on the media cache monitor. Called on the main thread only.
   void FlushPartialBlockInternal(bool aNotify, ReentrantMonitorAutoEnter& aReentrantMonitor);
 
   void NotifyDataStartedInternal(uint32_t aLoadID,
                                  int64_t aOffset,
                                  bool aSeekable,
                                  int64_t aLength);