Bug 1312540 - Simplify behaviour of GMP::GetPluginVersionForAPI. r=gerald draft
authorChris Pearce <cpearce@mozilla.com>
Tue, 01 Nov 2016 16:36:00 +1300
changeset 432363 e59fe8503a54d0e99184c0f76c5df8243b6b7693
parent 432362 713c276e73223e94ee11c82dcd6876487f1f33ef
child 432364 c16244e5649f28fade6a08813aaaffa33ae43446
child 432369 e16cba928173e1503ac3c3d370cae16110fd52a4
child 432379 1c6781ab4814578294722a0037eef76ba06568e8
push id34282
push usercpearce@mozilla.com
push dateTue, 01 Nov 2016 20:25:28 +0000
reviewersgerald
bugs1312540
milestone52.0a1
Bug 1312540 - Simplify behaviour of GMP::GetPluginVersionForAPI. r=gerald We only have one version of a GMP installed at once anyway. This version code is to support Adobe Primetime, and that's disabled. Making the behaviour of this code simpler will make it easier to have the same behaviour of the GetGMPVersion code in e10s and non-e10s mode. I will be removing this code soon, but I will do that in a later patch, so as to not complicate the uplift. MozReview-Commit-ID: 3cn7GhihWzm
dom/media/gmp/GMPServiceParent.cpp
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -975,29 +975,22 @@ GeckoMediaPluginServiceParent::GetPlugin
     NS_WARNING("Failed to load GMPs from disk.");
     return rv;
   }
 
   {
     MutexAutoLock lock(mMutex);
     nsCString api(aAPI);
     size_t index = 0;
-
-    // We must parse the version number into a float for comparison. Yuck.
-    double maxParsedVersion = -1.;
-
-    *aHasPlugin = false;
-    while (RefPtr<GMPParent> gmp = FindPluginForAPIFrom(index, api, *aTags, &index)) {
+    RefPtr<GMPParent> gmp = FindPluginForAPIFrom(index, api, *aTags, &index);
+    if (gmp) {
       *aHasPlugin = true;
-      double parsedVersion = atof(gmp->GetVersion().get());
-      if (maxParsedVersion < 0 || parsedVersion > maxParsedVersion) {
-        maxParsedVersion = parsedVersion;
-        aOutVersion = gmp->GetVersion();
-      }
-      index++;
+      aOutVersion = gmp->GetVersion();
+    } else {
+      *aHasPlugin = false;
     }
   }
 
   return NS_OK;
 }
 
 nsresult
 GeckoMediaPluginServiceParent::EnsurePluginsOnDiskScanned()