Bug 1367705. P1 - remove unused RecordStatisticsTo(). r=cpearce
authorJW Wang <jwwang@mozilla.com>
Fri, 02 Jun 2017 11:10:38 +0800
changeset 410564 b4002383a249f859a4fbb1c7f68bd763f526e731
parent 410563 46b6257d29c1f898540ce9453bfb791c50b738b1
child 410565 1ab72fcadc31dc40647053a8d89e38cd2919529d
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1367705
milestone55.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 1367705. P1 - remove unused RecordStatisticsTo(). r=cpearce This allows us to init mChannelStatistics in the constructor and remove the possibility where we deref a null mChannelStatistics. MozReview-Commit-ID: 9ZIRu0VXpd6
dom/media/MediaResource.h
--- a/dom/media/MediaResource.h
+++ b/dom/media/MediaResource.h
@@ -197,18 +197,16 @@ public:
   // because the underlying connection has been lost, or this resource
   // just can't be safely cloned). If this returns true, CloneData could
   // still fail. If this returns false, CloneData should not be called.
   virtual bool CanClone() { return false; }
   // Create a new stream of the same type that refers to the same URI
   // with a new channel. Any cached data associated with the original
   // stream should be accessible in the new stream too.
   virtual already_AddRefed<MediaResource> CloneData(MediaResourceCallback* aCallback) = 0;
-  // Set statistics to be recorded to the object passed in.
-  virtual void RecordStatisticsTo(MediaChannelStatistics *aStatistics) { }
 
   // These methods are called off the main thread.
   // The mode is initially MODE_PLAYBACK.
   virtual void SetReadMode(MediaCacheStream::ReadMode aMode) = 0;
   // This is the client's estimate of the playback rate assuming
   // the media plays continuously. The cache can't guess this itself
   // because it doesn't know when the decoder was paused, buffering, etc.
   virtual void SetPlaybackRate(uint32_t aBytesPerSecond) = 0;
@@ -577,25 +575,16 @@ public:
   nsresult Close() override;
   void     Suspend(bool aCloseImmediately) override;
   void     Resume() override;
   already_AddRefed<nsIPrincipal> GetCurrentPrincipal() override;
   // Return true if the stream has been closed.
   bool     IsClosed() const { return mCacheStream.IsClosed(); }
   bool     CanClone() override;
   already_AddRefed<MediaResource> CloneData(MediaResourceCallback* aDecoder) override;
-  // Set statistics to be recorded to the object passed in. If not called,
-  // |ChannelMediaResource| will create it's own statistics objects in |Open|.
-  void RecordStatisticsTo(MediaChannelStatistics *aStatistics) override {
-    NS_ASSERTION(aStatistics, "Statistics param cannot be null!");
-    MutexAutoLock lock(mLock);
-    if (!mChannelStatistics) {
-      mChannelStatistics = aStatistics;
-    }
-  }
   nsresult ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount) override;
   void     EnsureCacheUpToDate() override;
 
   // Other thread
   void     SetReadMode(MediaCacheStream::ReadMode aMode) override;
   void     SetPlaybackRate(uint32_t aBytesPerSecond) override;
   nsresult ReadAt(int64_t offset, char* aBuffer,
                   uint32_t aCount, uint32_t* aBytes) override;
@@ -613,17 +602,16 @@ public:
   bool    IsSuspendedByCache() override;
   bool    IsSuspended() override;
   bool    IsTransportSeekable() override;
 
   size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override {
     // Might be useful to track in the future:
     //   - mListener (seems minor)
     //   - mChannelStatistics (seems minor)
-    //     owned if RecordStatisticsTo is not called
     //   - mDataReceivedEvent (seems minor)
     size_t size = BaseMediaResource::SizeOfExcludingThis(aMallocSizeOf);
     size += mCacheStream.SizeOfExcludingThis(aMallocSizeOf);
 
     return size;
   }
 
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override {