Bug 1128389 - rename "keyschange" to "keystatuseschange" per spec change. r=bz. r=cpearce. a=lmandel
authorJW Wang <jwwang@mozilla.com>
Tue, 03 Feb 2015 16:53:36 +0800
changeset 250196 336529d8cd1a
parent 250195 88ab5bafc85a
child 250197 949ce3e9c42e
push id4521
push usercpearce@mozilla.com
push date2015-03-04 01:22 +0000
treeherdermozilla-beta@8abdbdecd2d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, cpearce, lmandel
bugs1128389
milestone37.0
Bug 1128389 - rename "keyschange" to "keystatuseschange" per spec change. r=bz. r=cpearce. a=lmandel
dom/base/nsGkAtomList.h
dom/media/eme/CDMCallbackProxy.cpp
dom/media/eme/CDMProxy.cpp
dom/media/eme/CDMProxy.h
dom/media/eme/MediaKeySession.cpp
dom/media/eme/MediaKeySession.h
dom/media/test/test_eme_persistent_sessions.html
dom/media/test/test_eme_playback.html
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -492,17 +492,17 @@ GK_ATOM(itemref, "itemref")
 GK_ATOM(itemscope, "itemscope")
 GK_ATOM(itemtype, "itemtype")
 GK_ATOM(kbd, "kbd")
 GK_ATOM(noautofocus, "noautofocus")
 GK_ATOM(keepcurrentinview, "keepcurrentinview")
 GK_ATOM(keepobjectsalive, "keepobjectsalive")
 GK_ATOM(key, "key")
 GK_ATOM(keycode, "keycode")
-GK_ATOM(keyschange, "keyschange")
+GK_ATOM(keystatuseschange, "keystatuseschange")
 GK_ATOM(keydown, "keydown")
 GK_ATOM(keygen, "keygen")
 GK_ATOM(keypress, "keypress")
 GK_ATOM(keyset, "keyset")
 GK_ATOM(keysystem, "keysystem")
 GK_ATOM(keytext, "keytext")
 GK_ATOM(keyup, "keyup")
 GK_ATOM(kind, "kind")
--- a/dom/media/eme/CDMCallbackProxy.cpp
+++ b/dom/media/eme/CDMCallbackProxy.cpp
@@ -268,27 +268,27 @@ CDMCallbackProxy::SessionError(const nsC
 
 void
 CDMCallbackProxy::KeyStatusChanged(const nsCString& aSessionId,
                                    const nsTArray<uint8_t>& aKeyId,
                                    GMPMediaKeyStatus aStatus)
 {
   MOZ_ASSERT(mProxy->IsOnGMPThread());
 
-  bool keysChange = false;
+  bool keyStatusesChange = false;
   {
     CDMCaps::AutoLock caps(mProxy->Capabilites());
-    keysChange = caps.SetKeyStatus(aKeyId,
-                                   NS_ConvertUTF8toUTF16(aSessionId),
-                                   aStatus);
+    keyStatusesChange = caps.SetKeyStatus(aKeyId,
+                                          NS_ConvertUTF8toUTF16(aSessionId),
+                                          aStatus);
   }
-  if (keysChange) {
+  if (keyStatusesChange) {
     nsRefPtr<nsIRunnable> task;
     task = NS_NewRunnableMethodWithArg<nsString>(mProxy,
-                                                 &CDMProxy::OnKeysChange,
+                                                 &CDMProxy::OnKeyStatusesChange,
                                                  NS_ConvertUTF8toUTF16(aSessionId));
     NS_DispatchToMainThread(task);
   }
 }
 
 void
 CDMCallbackProxy::SetCaps(uint64_t aCaps)
 {
--- a/dom/media/eme/CDMProxy.cpp
+++ b/dom/media/eme/CDMProxy.cpp
@@ -431,25 +431,25 @@ CDMProxy::OnSessionMessage(const nsAStri
   }
   nsRefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId));
   if (session) {
     session->DispatchKeyMessage(ToMediaKeyMessageType(aMessageType), aMessage);
   }
 }
 
 void
-CDMProxy::OnKeysChange(const nsAString& aSessionId)
+CDMProxy::OnKeyStatusesChange(const nsAString& aSessionId)
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (mKeys.IsNull()) {
     return;
   }
   nsRefPtr<dom::MediaKeySession> session(mKeys->GetSession(aSessionId));
   if (session) {
-    session->DispatchKeysChange();
+    session->DispatchKeyStatusesChange();
   }
 }
 
 void
 CDMProxy::OnExpirationChange(const nsAString& aSessionId,
                              GMPTimestamp aExpiryTime)
 {
   MOZ_ASSERT(NS_IsMainThread());
--- a/dom/media/eme/CDMProxy.h
+++ b/dom/media/eme/CDMProxy.h
@@ -159,17 +159,17 @@ public:
   // GMP thread only.
   void gmp_Decrypted(uint32_t aId,
                      GMPErr aResult,
                      const nsTArray<uint8_t>& aDecryptedData);
 
   CDMCaps& Capabilites();
 
   // Main thread only.
-  void OnKeysChange(const nsAString& aSessionId);
+  void OnKeyStatusesChange(const nsAString& aSessionId);
 
 #ifdef DEBUG
   bool IsOnGMPThread();
 #endif
 
 private:
 
   struct InitData {
--- a/dom/media/eme/MediaKeySession.cpp
+++ b/dom/media/eme/MediaKeySession.cpp
@@ -295,26 +295,26 @@ MediaKeySession::DispatchKeyError(uint32
 {
   RefPtr<MediaKeyError> event(new MediaKeyError(this, aSystemCode));
   nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
     new AsyncEventDispatcher(this, event);
   asyncDispatcher->PostDOMEvent();
 }
 
 void
-MediaKeySession::DispatchKeysChange()
+MediaKeySession::DispatchKeyStatusesChange()
 {
   if (IsClosed()) {
     return;
   }
 
   UpdateKeyStatusMap();
 
   nsRefPtr<AsyncEventDispatcher> asyncDispatcher =
-    new AsyncEventDispatcher(this, NS_LITERAL_STRING("keyschange"), false);
+    new AsyncEventDispatcher(this, NS_LITERAL_STRING("keystatuseschange"), false);
   asyncDispatcher->PostDOMEvent();
 }
 
 uint32_t
 MediaKeySession::Token() const
 {
   return mToken;
 }
--- a/dom/media/eme/MediaKeySession.h
+++ b/dom/media/eme/MediaKeySession.h
@@ -82,17 +82,17 @@ public:
 
   already_AddRefed<Promise> Remove(ErrorResult& aRv);
 
   void DispatchKeyMessage(MediaKeyMessageType aMessageType,
                           const nsTArray<uint8_t>& aMessage);
 
   void DispatchKeyError(uint32_t system_code);
 
-  void DispatchKeysChange();
+  void DispatchKeyStatusesChange();
 
   void OnClosed();
 
   bool IsClosed() const;
 
   // Process-unique identifier.
   uint32_t Token() const;
 
--- a/dom/media/test/test_eme_persistent_sessions.html
+++ b/dom/media/test/test_eme_persistent_sessions.html
@@ -34,35 +34,35 @@ function AwaitAllKeysUsable(session, key
       var map = session.keyStatuses;
       var usableKeyIds = [];
       for (var [key, val] of map.entries()) {
         is(val, "usable", token + ": key status should be usable");
         usableKeyIds.push(key);
       }
       if (UsableKeyIdsMatch(usableKeyIds, keys)) {
         Log(token, "resolving AwaitAllKeysUsable promise");
-        session.removeEventListener("keyschange", check);
+        session.removeEventListener("keystatuseschange", check);
         resolve();
       }
     }
-    session.addEventListener("keyschange", check);
+    session.addEventListener("keystatuseschange", check);
     check(); // in case all keys are already usable
   });
 }
 
 function AwaitAllKeysNotUsable(session, token) {
   return new Promise(function(resolve, reject) {
     function check() {
       var map = session.keyStatuses;
       if (map.size == 0) {
-        session.removeEventListener("keyschange", check);
+        session.removeEventListener("keystatuseschange", check);
         resolve();
       }
     }
-    session.addEventListener("keyschange", check);
+    session.addEventListener("keystatuseschange", check);
     check(); // in case all keys are already removed
   });
 }
 
 function startTest(test, token)
 {
   manager.started(token);
 
--- a/dom/media/test/test_eme_playback.html
+++ b/dom/media/test/test_eme_playback.html
@@ -38,17 +38,17 @@ function startTest(test, token)
   manager.started(token);
 
   var sessions = [];
 
   var v = SetupEME(test, token,
     {
       onsessioncreated: function(session) {
         sessions.push(session);
-        session.addEventListener("keyschange", KeysChangeFunc(session, test.keys, token), false);
+        session.addEventListener("keystatuseschange", KeysChangeFunc(session, test.keys, token), false);
       }
     }
   );
 
   var gotEncrypted = false;
   var gotPlaying = false;
 
   v.addEventListener("encrypted", function(ev) {
@@ -70,17 +70,17 @@ function startTest(test, token)
     ok(gotPlaying, TimeStamp(token) + " playing event should have fired");
 
     ok(Math.abs(test.duration - v.duration) < 0.1,
        TimeStamp(token) + " Duration of video should be corrrect");
     ok(Math.abs(test.duration - v.currentTime) < 0.1,
        TimeStamp(token) + " Current time should be same as duration");
 
     // Verify all sessions had all keys went sent the to the CDM usable, and thus
-    // that we received keyschange event(s).
+    // that we received keystatuseschange event(s).
     is(sessions.length, 1, TimeStamp(token) + " should have 1 session");
     for (var i = 0; i < sessions.length; i++) {
       var session = sessions[i];
       ok(session.gotKeysChanged, TimeStamp(token) + " should have received at least one keychange event");
       for (var kid in session.keyIdsReceived) {
         ok(session.keyIdsReceived[kid], TimeStamp(token) + " key with id " + kid + " was usable as expected");
       }
     }