Bug 1312540 - Simplify behaviour of GMP::GetPluginVersionForAPI. r=gerald
authorChris Pearce <cpearce@mozilla.com>
Tue, 01 Nov 2016 16:36:00 +1300
changeset 320439 8d38f007c9111c5fea264ac79914d1296a2992a3
parent 320438 97147b709fd84ed5693376f14b14e8d0d452d616
child 320440 255aac711339ce9a12fb5b1c4239c1fe4c7062a7
push id30901
push userkwierso@gmail.com
push dateThu, 03 Nov 2016 00:16:45 +0000
treeherdermozilla-central@ac55a6776435 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1312540
milestone52.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 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()