Bug 1290830 - [Part1] Detach the GMPDecryptorProxyCallback interface to DecryptorProxyCallback. r?cpearce draft
authorJames Cheng <jacheng@mozilla.com>
Mon, 01 Aug 2016 17:37:18 +0800
changeset 404340 bb5de0af6927b5b1ecdbab59aaeeb737e41a8a00
parent 404131 24763f58772d45279a935790f732d80851924b46
child 404341 7df6428f9f9020205c9952f209f9ff6ac2fc6512
push id27183
push userbmo:jacheng@mozilla.com
push dateTue, 23 Aug 2016 08:40:42 +0000
reviewerscpearce
bugs1290830
milestone51.0a1
Bug 1290830 - [Part1] Detach the GMPDecryptorProxyCallback interface to DecryptorProxyCallback. r?cpearce MozReview-Commit-ID: EPGf0ITakPO
dom/media/eme/DecryptorProxyCallback.h
dom/media/eme/moz.build
dom/media/gmp/GMPCDMProxy.h
dom/media/gmp/GMPDecryptorProxy.h
new file mode 100644
--- /dev/null
+++ b/dom/media/eme/DecryptorProxyCallback.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef DecryptorProxyCallback_h_
+#define DecryptorProxyCallback_h_
+
+class DecryptorProxyCallback {
+public:
+  virtual ~DecryptorProxyCallback() {}
+
+  virtual void SetSessionId(uint32_t aCreateSessionId,
+                            const nsCString& aSessionId) = 0;
+
+  virtual void ResolveLoadSessionPromise(uint32_t aPromiseId,
+                                         bool aSuccess) = 0;
+
+  virtual void ResolvePromise(uint32_t aPromiseId) = 0;
+
+  virtual void RejectPromise(uint32_t aPromiseId,
+                             nsresult aException,
+                             const nsCString& aSessionId) = 0;
+
+  virtual void SessionMessage(const nsCString& aSessionId,
+                              GMPSessionMessageType aMessageType,
+                              const nsTArray<uint8_t>& aMessage) = 0;
+
+  virtual void ExpirationChange(const nsCString& aSessionId,
+                                GMPTimestamp aExpiryTime) = 0;
+
+  virtual void SessionClosed(const nsCString& aSessionId) = 0;
+
+  virtual void SessionError(const nsCString& aSessionId,
+                            nsresult aException,
+                            uint32_t aSystemCode,
+                            const nsCString& aMessage) = 0;
+
+  virtual void KeyStatusChanged(const nsCString& aSessionId,
+                                const nsTArray<uint8_t>& aKeyId,
+                                GMPMediaKeyStatus aStatus) = 0;
+
+  virtual void Decrypted(uint32_t aId,
+                         GMPErr aResult,
+                         const nsTArray<uint8_t>& aDecryptedData) = 0;
+};
+
+#endif
\ No newline at end of file
--- a/dom/media/eme/moz.build
+++ b/dom/media/eme/moz.build
@@ -13,16 +13,17 @@ EXPORTS.mozilla.dom += [
     'MediaKeyStatusMap.h',
     'MediaKeySystemAccess.h',
     'MediaKeySystemAccessManager.h',
 ]
 
 EXPORTS.mozilla += [
     'CDMCaps.h',
     'CDMProxy.h',
+    'DecryptorProxyCallback.h',
     'DetailedPromise.h',
     'EMEUtils.h',
 ]
 
 UNIFIED_SOURCES += [
     'CDMCaps.cpp',
     'DetailedPromise.cpp',
     'EMEUtils.cpp',
--- a/dom/media/gmp/GMPCDMProxy.h
+++ b/dom/media/gmp/GMPCDMProxy.h
@@ -229,18 +229,16 @@ private:
   };
 
   ~GMPCDMProxy();
 
   GMPCrashHelper* mCrashHelper;
 
   GMPDecryptorProxy* mCDM;
 
-  CDMCaps mCapabilites;
-
   nsAutoPtr<GMPCDMCallbackProxy> mCallback;
 
   // Decryption jobs sent to CDM, awaiting result.
   // GMP thread only.
   nsTArray<RefPtr<DecryptJob>> mDecryptionJobs;
 
   // Number of buffers we've decrypted. Used to uniquely identify
   // decryption jobs sent to CDM. Note we can't just use the length of
--- a/dom/media/gmp/GMPDecryptorProxy.h
+++ b/dom/media/gmp/GMPDecryptorProxy.h
@@ -1,61 +1,29 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GMPDecryptorProxy_h_
 #define GMPDecryptorProxy_h_
 
+#include "mozilla/DecryptorProxyCallback.h"
 #include "GMPCallbackBase.h"
 #include "gmp-decryption.h"
 #include "nsString.h"
 
 namespace mozilla {
 class CryptoSample;
 } // namespace mozilla
 
-class GMPDecryptorProxyCallback : public GMPCallbackBase {
+class GMPDecryptorProxyCallback : public DecryptorProxyCallback,
+                                  public GMPCallbackBase {
 public:
-  ~GMPDecryptorProxyCallback() {}
-
-  virtual void SetSessionId(uint32_t aCreateSessionId,
-                            const nsCString& aSessionId) = 0;
-
-  virtual void ResolveLoadSessionPromise(uint32_t aPromiseId,
-                                         bool aSuccess) = 0;
-
-  virtual void ResolvePromise(uint32_t aPromiseId) = 0;
-
-  virtual void RejectPromise(uint32_t aPromiseId,
-                             nsresult aException,
-                             const nsCString& aSessionId) = 0;
-
-  virtual void SessionMessage(const nsCString& aSessionId,
-                              GMPSessionMessageType aMessageType,
-                              const nsTArray<uint8_t>& aMessage) = 0;
-
-  virtual void ExpirationChange(const nsCString& aSessionId,
-                                GMPTimestamp aExpiryTime) = 0;
-
-  virtual void SessionClosed(const nsCString& aSessionId) = 0;
-
-  virtual void SessionError(const nsCString& aSessionId,
-                            nsresult aException,
-                            uint32_t aSystemCode,
-                            const nsCString& aMessage) = 0;
-
-  virtual void KeyStatusChanged(const nsCString& aSessionId,
-                                const nsTArray<uint8_t>& aKeyId,
-                                GMPMediaKeyStatus aStatus) = 0;
-
-  virtual void Decrypted(uint32_t aId,
-                         GMPErr aResult,
-                         const nsTArray<uint8_t>& aDecryptedData) = 0;
+  virtual ~GMPDecryptorProxyCallback() {}
 };
 
 class GMPDecryptorProxy {
 public:
   ~GMPDecryptorProxy() {}
 
   virtual uint32_t GetPluginId() const = 0;