Bug 1038221 - Fix some WMF destructors to be private; r=cpearce
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 14 Jul 2014 21:51:13 -0400
changeset 215888 800fbf0e4630ae63acafacde6a22c8cc1bd8b12b
parent 215887 1c6e1080cee1a50145e853c761129dbec448d40b
child 215889 4ef82665a6e6b049a204d0ebb1355c1a3e926303
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1038221
milestone33.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 1038221 - Fix some WMF destructors to be private; r=cpearce
content/media/wmf/WMFByteStream.cpp
content/media/wmf/WMFByteStream.h
content/media/wmf/WMFSourceReaderCallback.h
--- a/content/media/wmf/WMFByteStream.cpp
+++ b/content/media/wmf/WMFByteStream.cpp
@@ -112,16 +112,18 @@ WMFByteStream::QueryInterface(REFIID aII
 }
 
 NS_IMPL_ADDREF(WMFByteStream)
 NS_IMPL_RELEASE(WMFByteStream)
 
 
 // Stores data regarding an async read opreation.
 class ReadRequest MOZ_FINAL : public IUnknown {
+  ~ReadRequest() {}
+
 public:
   ReadRequest(int64_t aOffset, BYTE* aBuffer, ULONG aLength)
     : mOffset(aOffset),
       mBuffer(aBuffer),
       mBufferLength(aLength),
       mBytesRead(0)
   {}
 
@@ -389,27 +391,27 @@ WMFByteStream::IsEndOfStream(BOOL *aEndO
   WMF_BS_LOG("[%p] WMFByteStream::IsEndOfStream() %d", this, *aEndOfStream);
   return S_OK;
 }
 
 STDMETHODIMP
 WMFByteStream::Read(BYTE* aBuffer, ULONG aBufferLength, ULONG* aOutBytesRead)
 {
   ReentrantMonitorAutoEnter mon(mReentrantMonitor);
-  ReadRequest request(mOffset, aBuffer, aBufferLength);
-  if (NS_FAILED(Read(&request))) {
+  nsRefPtr<ReadRequest> request = new ReadRequest(mOffset, aBuffer, aBufferLength);
+  if (NS_FAILED(Read(request))) {
     WMF_BS_LOG("[%p] WMFByteStream::Read() offset=%lld failed!", this, mOffset);
     return E_FAIL;
   }
   if (aOutBytesRead) {
-    *aOutBytesRead = request.mBytesRead;
+    *aOutBytesRead = request->mBytesRead;
   }
   WMF_BS_LOG("[%p] WMFByteStream::Read() offset=%lld length=%u bytesRead=%u",
-             this, mOffset, aBufferLength, request.mBytesRead);
-  mOffset += request.mBytesRead;
+             this, mOffset, aBufferLength, request->mBytesRead);
+  mOffset += request->mBytesRead;
   return S_OK;
 }
 
 STDMETHODIMP
 WMFByteStream::Seek(MFBYTESTREAM_SEEK_ORIGIN aSeekOrigin,
                     LONGLONG aSeekOffset,
                     DWORD aSeekFlags,
                     QWORD *aCurrentPosition)
--- a/content/media/wmf/WMFByteStream.h
+++ b/content/media/wmf/WMFByteStream.h
@@ -31,19 +31,20 @@ class SharedThreadPool;
 // Note: This implementation attempts to be bug-compatible with Windows Media
 //       Foundation's implementation of IMFByteStream. The behaviour of WMF's
 //       IMFByteStream was determined by creating it and testing the edge cases.
 //       For details see the test code at:
 //       https://github.com/cpearce/IMFByteStreamBehaviour/
 class WMFByteStream MOZ_FINAL : public IMFByteStream
                               , public IMFAttributes
 {
+  ~WMFByteStream();
+
 public:
   WMFByteStream(MediaResource* aResource, WMFSourceReaderCallback* aCallback);
-  ~WMFByteStream();
 
   nsresult Init();
   nsresult Shutdown();
 
   // IUnknown Methods.
   STDMETHODIMP QueryInterface(REFIID aIId, LPVOID *aInterface);
   STDMETHODIMP_(ULONG) AddRef();
   STDMETHODIMP_(ULONG) Release();
--- a/content/media/wmf/WMFSourceReaderCallback.h
+++ b/content/media/wmf/WMFSourceReaderCallback.h
@@ -16,16 +16,18 @@ namespace mozilla {
 // A listener which we pass into the IMFSourceReader upon creation which is
 // notified when an asynchronous call to IMFSourceReader::ReadSample()
 // completes. This allows us to abort ReadSample() operations when the
 // WMFByteStream's underlying MediaResource is closed. This ensures that
 // the decode threads don't get stuck in a synchronous ReadSample() call
 // when the MediaResource is unexpectedly shutdown.
 class WMFSourceReaderCallback MOZ_FINAL : public IMFSourceReaderCallback
 {
+  ~WMFSourceReaderCallback() {}
+
 public:
   WMFSourceReaderCallback();
 
   // IUnknown Methods.
   STDMETHODIMP QueryInterface(REFIID aIId, LPVOID *aInterface);
   STDMETHODIMP_(ULONG) AddRef();
   STDMETHODIMP_(ULONG) Release();