Bug 1394651 - remove MediaResource from the base class of HLSResource. r=gerald
authorJW Wang <jwwang@mozilla.com>
Fri, 25 Aug 2017 14:03:45 +0800
changeset 377367 293be271179db3e8fbf18055e9e84a7c4c879694
parent 377366 ec93b3b4878be9a51af84b9a78f8c3779002c43e
child 377368 8514e013efd37618a723acb7aaea93078a0221a2
push id49871
push userjwwang@mozilla.com
push dateTue, 29 Aug 2017 06:02:55 +0000
treeherderautoland@293be271179d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1394651
milestone57.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 1394651 - remove MediaResource from the base class of HLSResource. r=gerald MozReview-Commit-ID: 3RaLXA1kKzA
dom/media/hls/HLSDecoder.cpp
dom/media/hls/HLSDecoder.h
dom/media/hls/HLSResource.h
--- a/dom/media/hls/HLSDecoder.cpp
+++ b/dom/media/hls/HLSDecoder.cpp
@@ -68,17 +68,17 @@ HLSDecoder::Load(nsIChannel* aChannel)
   MOZ_ASSERT(!mResource);
 
   nsCOMPtr<nsIURI> uri;
   nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  mResource = new HLSResource(this, aChannel, uri);
+  mResource = MakeUnique<HLSResource>(this, aChannel, uri);
 
   rv = MediaShutdownManager::Instance().Register(this);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   SetStateMachine(CreateStateMachine());
   NS_ENSURE_TRUE(GetStateMachine(), NS_ERROR_FAILURE);
--- a/dom/media/hls/HLSDecoder.h
+++ b/dom/media/hls/HLSDecoder.h
@@ -53,14 +53,14 @@ private:
   {
     // TODO: We don't know how to estimate 'canplaythrough' for this decoder.
     // For now we just return true for 'autoplay' can work.
     return true;
   }
 
   bool IsLiveStream() override final { return false; }
 
-  RefPtr<HLSResource> mResource;
+  UniquePtr<HLSResource> mResource;
 };
 
 } // namespace mozilla
 
 #endif /* HLSDecoder_h_ */
--- a/dom/media/hls/HLSResource.h
+++ b/dom/media/hls/HLSResource.h
@@ -5,21 +5,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef HLSResource_h_
 #define HLSResource_h_
 
 #include "GeneratedJNINatives.h"
 #include "GeneratedJNIWrappers.h"
 #include "HLSUtils.h"
-#include "MediaResource.h"
 #include "nsContentUtils.h"
 
-#define UNIMPLEMENTED() HLS_DEBUG("HLSResource", "UNIMPLEMENTED FUNCTION")
-
 using namespace mozilla::java;
 
 namespace mozilla {
 
 class HLSDecoder;
 class HLSResource;
 
 class HLSResourceCallbacksSupport
@@ -36,52 +33,36 @@ public:
   void OnDataArrived();
   void OnError(int aErrorCode);
 
 private:
   ~HLSResourceCallbacksSupport() {}
   HLSResource* mResource;
 };
 
-class HLSResource final : public MediaResource
+class HLSResource final
 {
 public:
   HLSResource(HLSDecoder* aDecoder, nsIChannel* aChannel, nsIURI* aURI);
   ~HLSResource();
   void Suspend();
   void Resume();
-  nsresult ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes) override { UNIMPLEMENTED(); return NS_ERROR_FAILURE; }
-  bool ShouldCacheReads() override { UNIMPLEMENTED(); return false; }
-  int64_t Tell() override { UNIMPLEMENTED(); return -1; }
-  void Pin() override { UNIMPLEMENTED(); }
-  void Unpin() override { UNIMPLEMENTED(); }
-  int64_t GetLength() override { UNIMPLEMENTED(); return -1; }
-  int64_t GetNextCachedData(int64_t aOffset) override { UNIMPLEMENTED(); return -1; }
-  int64_t GetCachedDataEnd(int64_t aOffset) override { UNIMPLEMENTED(); return -1; }
-  bool IsDataCachedToEndOfResource(int64_t aOffset) override { UNIMPLEMENTED(); return false; }
-  nsresult ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount) override { UNIMPLEMENTED(); return NS_ERROR_FAILURE; }
 
   already_AddRefed<nsIPrincipal> GetCurrentPrincipal()
   {
     NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
 
     nsCOMPtr<nsIPrincipal> principal;
     nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
     if (!secMan || !mChannel)
       return nullptr;
     secMan->GetChannelResultPrincipal(mChannel, getter_AddRefs(principal));
     return principal.forget();
   }
 
-  nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override
-  {
-    UNIMPLEMENTED();
-    return NS_OK;
-  }
-
   java::GeckoHLSResourceWrapper::GlobalRef GetResourceWrapper() {
     return mHLSResourceWrapper;
   }
 
   void Detach() { mDecoder = nullptr; }
 
   size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
   {