Bug 1367705. P1 - remove unused RecordStatisticsTo().
This allows us to init mChannelStatistics in the constructor and
remove the possibility where we deref a null mChannelStatistics.
MozReview-Commit-ID: 9ZIRu0VXpd6
--- 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 {