Bug 1290830 - [Part1] Detach the GMPDecryptorProxyCallback interface to DecryptorProxyCallback. r=cpearce
authorJames Cheng <jacheng@mozilla.com>
Mon, 01 Aug 2016 17:37:18 +0800
changeset 336582 3942a7c1224c42b30ca858a23148fc4f0bc5066a
parent 336581 dfb4628966bee243c847defa57241aafc5c0d9cd
child 336583 65b00e9620d16d97576cc90f0a4e0129c0e241be
push id10033
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:50:26 +0000
treeherdermozilla-aurora@5dddbefdf759 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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;