Bug 1340189: P2. Fix style and on the fly changes. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 16 Feb 2017 20:27:52 +0100
changeset 485631 b0535c3abf043581365af9f2470913ffd0bc0e65
parent 485630 8dcc477641cacb6da577b481623819bb28566b1f
child 485632 fe97d086ea2f35000704fc16ac8feafb755ca599
push id45794
push userbmo:jyavenard@mozilla.com
push dateThu, 16 Feb 2017 23:30:50 +0000
reviewersgerald
bugs1340189
milestone54.0a1
Bug 1340189: P2. Fix style and on the fly changes. r?gerald On the fly changes include: * Using C++11 iterator for parsing arrays * Making internal, local functions static. MozReview-Commit-ID: C5fNsjHiknJ
dom/media/gmp/GMPChild.cpp
dom/media/gmp/GMPChild.h
dom/media/gmp/GMPContentChild.cpp
dom/media/gmp/GMPContentChild.h
dom/media/gmp/GMPContentParent.cpp
dom/media/gmp/GMPContentParent.h
dom/media/gmp/GMPCrashHelper.cpp
dom/media/gmp/GMPCrashHelper.h
dom/media/gmp/GMPCrashHelperHolder.cpp
dom/media/gmp/GMPDecryptorChild.cpp
dom/media/gmp/GMPDecryptorChild.h
dom/media/gmp/GMPDecryptorParent.cpp
dom/media/gmp/GMPDecryptorParent.h
dom/media/gmp/GMPDecryptorProxy.h
dom/media/gmp/GMPDiskStorage.cpp
dom/media/gmp/GMPEncryptedBufferDataImpl.cpp
dom/media/gmp/GMPEncryptedBufferDataImpl.h
dom/media/gmp/GMPLoader.cpp
dom/media/gmp/GMPLoader.h
dom/media/gmp/GMPMemoryStorage.cpp
dom/media/gmp/GMPMessageUtils.h
dom/media/gmp/GMPParent.cpp
dom/media/gmp/GMPParent.h
dom/media/gmp/GMPPlatform.cpp
dom/media/gmp/GMPPlatform.h
dom/media/gmp/GMPProcessChild.cpp
dom/media/gmp/GMPProcessChild.h
dom/media/gmp/GMPProcessParent.cpp
dom/media/gmp/GMPProcessParent.h
dom/media/gmp/GMPService.cpp
dom/media/gmp/GMPService.h
dom/media/gmp/GMPServiceChild.cpp
dom/media/gmp/GMPServiceChild.h
dom/media/gmp/GMPServiceParent.cpp
dom/media/gmp/GMPServiceParent.h
dom/media/gmp/GMPSharedMemManager.cpp
dom/media/gmp/GMPSharedMemManager.h
dom/media/gmp/GMPStorage.h
dom/media/gmp/GMPStorageChild.cpp
dom/media/gmp/GMPStorageChild.h
dom/media/gmp/GMPStorageParent.cpp
dom/media/gmp/GMPStorageParent.h
dom/media/gmp/GMPTimerChild.cpp
dom/media/gmp/GMPTimerChild.h
dom/media/gmp/GMPTimerParent.h
dom/media/gmp/GMPTypes.ipdlh
dom/media/gmp/GMPUtils.cpp
dom/media/gmp/GMPUtils.h
dom/media/gmp/GMPVideoDecoderChild.cpp
dom/media/gmp/GMPVideoDecoderChild.h
dom/media/gmp/GMPVideoDecoderParent.cpp
dom/media/gmp/GMPVideoDecoderParent.h
dom/media/gmp/GMPVideoDecoderProxy.h
dom/media/gmp/GMPVideoEncodedFrameImpl.cpp
dom/media/gmp/GMPVideoEncodedFrameImpl.h
dom/media/gmp/GMPVideoEncoderChild.cpp
dom/media/gmp/GMPVideoEncoderChild.h
dom/media/gmp/GMPVideoEncoderParent.cpp
dom/media/gmp/GMPVideoEncoderParent.h
dom/media/gmp/GMPVideoEncoderProxy.h
dom/media/gmp/GMPVideoHost.cpp
dom/media/gmp/GMPVideoHost.h
dom/media/gmp/GMPVideoPlaneImpl.cpp
dom/media/gmp/GMPVideoPlaneImpl.h
dom/media/gmp/GMPVideoi420FrameImpl.cpp
dom/media/gmp/GMPVideoi420FrameImpl.h
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -1,32 +1,32 @@
 /* -*- 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/. */
 
 #include "GMPChild.h"
 #include "GMPContentChild.h"
+#include "GMPDecryptorChild.h"
+#include "GMPLoader.h"
+#include "GMPPlatform.h"
 #include "GMPProcessChild.h"
-#include "GMPLoader.h"
+#include "GMPUtils.h"
 #include "GMPVideoDecoderChild.h"
 #include "GMPVideoEncoderChild.h"
-#include "GMPDecryptorChild.h"
 #include "GMPVideoHost.h"
+#include "base/task.h"
+#include "gmp-video-decode.h"
+#include "gmp-video-encode.h"
+#include "mozilla/ipc/CrashReporterClient.h"
+#include "mozilla/ipc/ProcessChild.h"
 #include "nsDebugImpl.h"
 #include "nsIFile.h"
 #include "nsXULAppAPI.h"
-#include "gmp-video-decode.h"
-#include "gmp-video-encode.h"
-#include "GMPPlatform.h"
-#include "mozilla/ipc/CrashReporterClient.h"
-#include "mozilla/ipc/ProcessChild.h"
-#include "GMPUtils.h"
 #include "prio.h"
-#include "base/task.h"
 #include "widevine-adapter/WidevineAdapter.h"
 
 using namespace mozilla::ipc;
 
 #ifdef XP_WIN
 #include <stdlib.h> // for _exit()
 #else
 #include <unistd.h> // for _exit()
@@ -85,36 +85,36 @@ GetFileBase(const nsAString& aPluginPath
   }
 
   nsAutoString parentLeafName;
   rv = parent->GetLeafName(parentLeafName);
   if (NS_FAILED(rv)) {
     return false;
   }
 
-  aBaseName = Substring(parentLeafName,
-                        4,
-                        parentLeafName.Length() - 1);
+  aBaseName = Substring(parentLeafName, 4, parentLeafName.Length() - 1);
   return true;
 }
 
 static bool
 GetPluginFile(const nsAString& aPluginPath,
               nsCOMPtr<nsIFile>& aLibDirectory,
               nsCOMPtr<nsIFile>& aLibFile)
 {
   nsAutoString baseName;
   GetFileBase(aPluginPath, aLibDirectory, aLibFile, baseName);
 
 #if defined(XP_MACOSX)
-  nsAutoString binaryName = NS_LITERAL_STRING("lib") + baseName + NS_LITERAL_STRING(".dylib");
+  nsAutoString binaryName =
+    NS_LITERAL_STRING("lib") + baseName + NS_LITERAL_STRING(".dylib");
 #elif defined(OS_POSIX)
-  nsAutoString binaryName = NS_LITERAL_STRING("lib") + baseName + NS_LITERAL_STRING(".so");
+  nsAutoString binaryName =
+    NS_LITERAL_STRING("lib") + baseName + NS_LITERAL_STRING(".so");
 #elif defined(XP_WIN)
-  nsAutoString binaryName =                            baseName + NS_LITERAL_STRING(".dll");
+  nsAutoString binaryName = baseName + NS_LITERAL_STRING(".dll");
 #else
 #error not defined
 #endif
   aLibFile->AppendRelativePath(binaryName);
   return true;
 }
 
 #if !defined(XP_MACOSX) || !defined(MOZ_GMP_SANDBOX)
@@ -214,18 +214,18 @@ GMPChild::SetMacSandboxInfo(MacSandboxPl
   }
   nsAutoCString appPath, appBinaryPath;
   if (!GetAppPaths(appPath, appBinaryPath)) {
     return false;
   }
 
   MacSandboxInfo info;
   info.type = MacSandboxType_Plugin;
-  info.shouldLog = Preferences::GetBool("security.sandbox.logging.enabled") ||
-                   PR_GetEnv("MOZ_SANDBOX_LOGGING");
+  info.shouldLog = Preferences::GetBool("security.sandbox.logging.enabled")
+                   || PR_GetEnv("MOZ_SANDBOX_LOGGING");
   info.pluginInfo.type = aPluginType;
   info.pluginInfo.pluginPath.assign(pluginDirectoryPath.get());
   info.pluginInfo.pluginBinaryPath.assign(pluginFilePath.get());
   info.appPath.assign(appPath.get());
   info.appBinaryPath.assign(appBinaryPath.get());
 
   mGMPLoader->SetSandboxInfo(&info);
   return true;
@@ -233,17 +233,18 @@ GMPChild::SetMacSandboxInfo(MacSandboxPl
 #endif // XP_MACOSX && MOZ_GMP_SANDBOX
 
 bool
 GMPChild::Init(const nsAString& aPluginPath,
                base::ProcessId aParentPid,
                MessageLoop* aIOLoop,
                IPC::Channel* aChannel)
 {
-  LOGD("%s pluginPath=%s", __FUNCTION__, NS_ConvertUTF16toUTF8(aPluginPath).get());
+  LOGD(
+    "%s pluginPath=%s", __FUNCTION__, NS_ConvertUTF16toUTF8(aPluginPath).get());
 
   if (NS_WARN_IF(!Open(aChannel, aParentPid, aIOLoop))) {
     return false;
   }
 
 #ifdef MOZ_CRASHREPORTER
   CrashReporterClient::InitSingleton(this);
 #endif
@@ -378,17 +379,18 @@ GMPChild::GMPMessageLoop()
 }
 
 void
 GMPChild::ActorDestroy(ActorDestroyReason aWhy)
 {
   LOGD("%s reason=%d", __FUNCTION__, aWhy);
 
   for (uint32_t i = mGMPContentChildren.Length(); i > 0; i--) {
-    MOZ_ASSERT_IF(aWhy == NormalShutdown, !mGMPContentChildren[i - 1]->IsUsed());
+    MOZ_ASSERT_IF(aWhy == NormalShutdown,
+                  !mGMPContentChildren[i - 1]->IsUsed());
     mGMPContentChildren[i - 1]->Close();
   }
 
   if (mGMPLoader) {
     mGMPLoader->Shutdown();
   }
   if (AbnormalShutdown == aWhy) {
     NS_WARNING("Abnormal shutdown of GMP process!");
--- a/dom/media/gmp/GMPChild.h
+++ b/dom/media/gmp/GMPChild.h
@@ -1,21 +1,21 @@
 /* -*- 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 GMPChild_h_
 #define GMPChild_h_
 
-#include "mozilla/gmp/PGMPChild.h"
-#include "GMPTimerChild.h"
+#include "GMPLoader.h"
 #include "GMPStorageChild.h"
-#include "GMPLoader.h"
+#include "GMPTimerChild.h"
 #include "gmp-entrypoints.h"
+#include "mozilla/gmp/PGMPChild.h"
 #include "prlink.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPContentChild;
 
 class GMPChild : public PGMPChild
@@ -52,22 +52,26 @@ private:
   PGMPStorageChild* AllocPGMPStorageChild() override;
   bool DeallocPGMPStorageChild(PGMPStorageChild* aActor) override;
 
   void GMPContentChildActorDestroy(GMPContentChild* aGMPContentChild);
 
   mozilla::ipc::IPCResult RecvCrashPluginNow() override;
   mozilla::ipc::IPCResult RecvCloseActive() override;
 
-  mozilla::ipc::IPCResult RecvInitGMPContentChild(Endpoint<PGMPContentChild>&& aEndpoint) override;
+  mozilla::ipc::IPCResult RecvInitGMPContentChild(
+    Endpoint<PGMPContentChild>&& aEndpoint) override;
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
   void ProcessingError(Result aCode, const char* aReason) override;
 
-  GMPErr GetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI, uint32_t aDecryptorId = 0);
+  GMPErr GetAPI(const char* aAPIName,
+                void* aHostAPI,
+                void** aPluginAPI,
+                uint32_t aDecryptorId = 0);
 
   nsTArray<UniquePtr<GMPContentChild>> mGMPContentChildren;
 
   RefPtr<GMPTimerChild> mTimerChild;
   RefPtr<GMPStorageChild> mStorage;
 
   MessageLoop* mGMPMessageLoop;
   nsString mPluginPath;
--- a/dom/media/gmp/GMPContentChild.cpp
+++ b/dom/media/gmp/GMPContentChild.cpp
@@ -94,34 +94,36 @@ GMPContentChild::DeallocPGMPVideoEncoder
 }
 
 mozilla::ipc::IPCResult
 GMPContentChild::RecvPGMPDecryptorConstructor(PGMPDecryptorChild* aActor)
 {
   GMPDecryptorChild* child = static_cast<GMPDecryptorChild*>(aActor);
 
   void* ptr = nullptr;
-  GMPErr err = mGMPChild->GetAPI(GMP_API_DECRYPTOR, nullptr, &ptr, aActor->Id());
+  GMPErr err =
+    mGMPChild->GetAPI(GMP_API_DECRYPTOR, nullptr, &ptr, aActor->Id());
   if (err != GMPNoErr || !ptr) {
     NS_WARNING("GMPGetAPI call failed trying to construct decryptor.");
     return IPC_FAIL_NO_REASON(this);
   }
   child->Init(static_cast<GMPDecryptor*>(ptr));
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPContentChild::RecvPGMPVideoDecoderConstructor(PGMPVideoDecoderChild* aActor,
                                                  const uint32_t& aDecryptorId)
 {
   auto vdc = static_cast<GMPVideoDecoderChild*>(aActor);
 
   void* vd = nullptr;
-  GMPErr err = mGMPChild->GetAPI(GMP_API_VIDEO_DECODER, &vdc->Host(), &vd, aDecryptorId);
+  GMPErr err =
+    mGMPChild->GetAPI(GMP_API_VIDEO_DECODER, &vdc->Host(), &vd, aDecryptorId);
   if (err != GMPNoErr || !vd) {
     NS_WARNING("GMPGetAPI call failed trying to construct decoder.");
     return IPC_FAIL_NO_REASON(this);
   }
 
   vdc->Init(static_cast<GMPVideoDecoder*>(vd));
 
   return IPC_OK();
@@ -165,15 +167,15 @@ GMPContentChild::CloseActive()
   for (auto iter = videoEncoders.ConstIter(); !iter.Done(); iter.Next()) {
     iter.Get()->GetKey()->SendShutdown();
   }
 }
 
 bool
 GMPContentChild::IsUsed()
 {
-  return !ManagedPGMPDecryptorChild().IsEmpty() ||
-         !ManagedPGMPVideoDecoderChild().IsEmpty() ||
-         !ManagedPGMPVideoEncoderChild().IsEmpty();
+  return !ManagedPGMPDecryptorChild().IsEmpty()
+         || !ManagedPGMPVideoDecoderChild().IsEmpty()
+         || !ManagedPGMPVideoEncoderChild().IsEmpty();
 }
 
 } // namespace gmp
 } // namespace mozilla
--- a/dom/media/gmp/GMPContentChild.h
+++ b/dom/media/gmp/GMPContentChild.h
@@ -1,41 +1,46 @@
 /* -*- 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 GMPContentChild_h_
 #define GMPContentChild_h_
 
+#include "GMPSharedMemManager.h"
 #include "mozilla/gmp/PGMPContentChild.h"
-#include "GMPSharedMemManager.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPChild;
 
 class GMPContentChild : public PGMPContentChild
                       , public GMPSharedMem
 {
 public:
   explicit GMPContentChild(GMPChild* aChild);
   virtual ~GMPContentChild();
 
   MessageLoop* GMPMessageLoop();
 
-  mozilla::ipc::IPCResult RecvPGMPDecryptorConstructor(PGMPDecryptorChild* aActor) override;
-  mozilla::ipc::IPCResult RecvPGMPVideoDecoderConstructor(PGMPVideoDecoderChild* aActor, const uint32_t& aDecryptorId) override;
-  mozilla::ipc::IPCResult RecvPGMPVideoEncoderConstructor(PGMPVideoEncoderChild* aActor) override;
+  mozilla::ipc::IPCResult RecvPGMPDecryptorConstructor(
+    PGMPDecryptorChild* aActor) override;
+  mozilla::ipc::IPCResult RecvPGMPVideoDecoderConstructor(
+    PGMPVideoDecoderChild* aActor,
+    const uint32_t& aDecryptorId) override;
+  mozilla::ipc::IPCResult RecvPGMPVideoEncoderConstructor(
+    PGMPVideoEncoderChild* aActor) override;
 
   PGMPDecryptorChild* AllocPGMPDecryptorChild() override;
   bool DeallocPGMPDecryptorChild(PGMPDecryptorChild* aActor) override;
 
-  PGMPVideoDecoderChild* AllocPGMPVideoDecoderChild(const uint32_t& aDecryptorId) override;
+  PGMPVideoDecoderChild* AllocPGMPVideoDecoderChild(
+    const uint32_t& aDecryptorId) override;
   bool DeallocPGMPVideoDecoderChild(PGMPVideoDecoderChild* aActor) override;
 
   PGMPVideoEncoderChild* AllocPGMPVideoEncoderChild() override;
   bool DeallocPGMPVideoEncoderChild(PGMPVideoEncoderChild* aActor) override;
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
   void ProcessingError(Result aCode, const char* aReason) override;
 
--- a/dom/media/gmp/GMPContentParent.cpp
+++ b/dom/media/gmp/GMPContentParent.cpp
@@ -60,19 +60,19 @@ public:
 
 private:
   RefPtr<GMPContentParent> mToRelease;
 };
 
 void
 GMPContentParent::ActorDestroy(ActorDestroyReason aWhy)
 {
-  MOZ_ASSERT(mDecryptors.IsEmpty() &&
-             mVideoDecoders.IsEmpty() &&
-             mVideoEncoders.IsEmpty());
+  MOZ_ASSERT(mDecryptors.IsEmpty()
+             && mVideoDecoders.IsEmpty()
+             && mVideoEncoders.IsEmpty());
   NS_DispatchToCurrentThread(new ReleaseGMPContentParent(this));
 }
 
 void
 GMPContentParent::CheckThread()
 {
   MOZ_ASSERT(mGMPThread == NS_GetCurrentThread());
 }
@@ -119,20 +119,20 @@ GMPContentParent::RemoveCloseBlocker()
   MOZ_ASSERT(GMPThread() == NS_GetCurrentThread());
   --mCloseBlockerCount;
   CloseIfUnused();
 }
 
 void
 GMPContentParent::CloseIfUnused()
 {
-  if (mDecryptors.IsEmpty() &&
-      mVideoDecoders.IsEmpty() &&
-      mVideoEncoders.IsEmpty() &&
-      mCloseBlockerCount == 0) {
+  if (mDecryptors.IsEmpty()
+      && mVideoDecoders.IsEmpty()
+      && mVideoEncoders.IsEmpty()
+      && mCloseBlockerCount == 0) {
     RefPtr<GMPContentParent> toClose;
     if (mParent) {
       toClose = mParent->ForgetGMPContentParent();
     } else {
       toClose = this;
       RefPtr<GeckoMediaPluginServiceChild> gmp(
         GeckoMediaPluginServiceChild::GetSingleton());
       gmp->RemoveGMPContentParent(toClose);
@@ -158,17 +158,18 @@ GMPContentParent::GetGMPDecryptor(GMPDec
 
   return NS_OK;
 }
 
 nsIThread*
 GMPContentParent::GMPThread()
 {
   if (!mGMPThread) {
-    nsCOMPtr<mozIGeckoMediaPluginService> mps = do_GetService("@mozilla.org/gecko-media-plugin-service;1");
+    nsCOMPtr<mozIGeckoMediaPluginService> mps =
+      do_GetService("@mozilla.org/gecko-media-plugin-service;1");
     MOZ_ASSERT(mps);
     if (!mps) {
       return nullptr;
     }
     // Not really safe if we just grab to the mGMPThread, as we don't know
     // what thread we're running on and other threads may be trying to
     // access this without locks!  However, debug only, and primary failure
     // mode outside of compiler-helped TSAN is a leak.  But better would be
--- a/dom/media/gmp/GMPContentParent.h
+++ b/dom/media/gmp/GMPContentParent.h
@@ -1,18 +1,18 @@
 /* -*- 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 GMPContentParent_h_
 #define GMPContentParent_h_
 
+#include "GMPSharedMemManager.h"
 #include "mozilla/gmp/PGMPContentParent.h"
-#include "GMPSharedMemManager.h"
 #include "nsISupportsImpl.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPDecryptorParent;
 class GMPParent;
 class GMPVideoDecoderParent;
@@ -53,42 +53,45 @@ public:
   {
     mPluginId = aPluginId;
   }
   uint32_t GetPluginId() const
   {
     return mPluginId;
   }
 
-  class CloseBlocker {
+  class CloseBlocker
+  {
   public:
     NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CloseBlocker)
 
     explicit CloseBlocker(GMPContentParent* aParent)
       : mParent(aParent)
     {
       mParent->AddCloseBlocker();
     }
     RefPtr<GMPContentParent> mParent;
   private:
-    ~CloseBlocker() {
+    ~CloseBlocker()
+    {
       mParent->RemoveCloseBlocker();
     }
   };
 
 private:
 
   void AddCloseBlocker();
   void RemoveCloseBlocker();
 
   ~GMPContentParent();
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
-  PGMPVideoDecoderParent* AllocPGMPVideoDecoderParent(const uint32_t& aDecryptorId) override;
+  PGMPVideoDecoderParent* AllocPGMPVideoDecoderParent(
+    const uint32_t& aDecryptorId) override;
   bool DeallocPGMPVideoDecoderParent(PGMPVideoDecoderParent* aActor) override;
 
   PGMPVideoEncoderParent* AllocPGMPVideoEncoderParent() override;
   bool DeallocPGMPVideoEncoderParent(PGMPVideoEncoderParent* aActor) override;
 
   PGMPDecryptorParent* AllocPGMPDecryptorParent() override;
   bool DeallocPGMPDecryptorParent(PGMPDecryptorParent* aActor) override;
 
--- a/dom/media/gmp/GMPCrashHelper.cpp
+++ b/dom/media/gmp/GMPCrashHelper.cpp
@@ -1,26 +1,27 @@
 /* -*- 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/. */
 
 #include "GMPCrashHelper.h"
+#include "nsThreadUtils.h"
 #include "runnable_utils.h"
-#include "nsThreadUtils.h"
 
 namespace mozilla {
 
 NS_IMPL_ADDREF(GMPCrashHelper)
 NS_IMPL_RELEASE_WITH_DESTROY(GMPCrashHelper, Destroy())
 
 void
 GMPCrashHelper::Destroy()
 {
   if (NS_IsMainThread()) {
     delete this;
   } else {
     // Don't addref, as then we'd end up releasing after the detele runs!
-    NS_DispatchToMainThread(mozilla::NewNonOwningRunnableMethod(this, &GMPCrashHelper::Destroy));
+    NS_DispatchToMainThread(
+      mozilla::NewNonOwningRunnableMethod(this, &GMPCrashHelper::Destroy));
   }
 }
 
 } // namespace mozilla
--- a/dom/media/gmp/GMPCrashHelper.h
+++ b/dom/media/gmp/GMPCrashHelper.h
@@ -19,17 +19,18 @@ namespace mozilla {
 // that instances are destroyed on the main thread.
 class GMPCrashHelper
 {
 public:
   NS_METHOD_(MozExternalRefCountType) AddRef(void);
   NS_METHOD_(MozExternalRefCountType) Release(void);
 
   // Called on the main thread.
-  virtual already_AddRefed<nsPIDOMWindowInner> GetPluginCrashedEventTarget() = 0;
+  virtual already_AddRefed<nsPIDOMWindowInner>
+  GetPluginCrashedEventTarget() = 0;
 
 protected:
   virtual ~GMPCrashHelper()
   {
     MOZ_ASSERT(NS_IsMainThread());
   }
   void Destroy();
   mozilla::ThreadSafeAutoRefCnt mRefCnt;
--- a/dom/media/gmp/GMPCrashHelperHolder.cpp
+++ b/dom/media/gmp/GMPCrashHelperHolder.cpp
@@ -2,18 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #include "GMPCrashHelperHolder.h"
 #include "GMPService.h"
 #include "mozilla/RefPtr.h"
+#include "mozilla/ipc/ProtocolUtils.h"
 #include "nsPIDOMWindow.h"
-#include "mozilla/ipc/ProtocolUtils.h"
 
 namespace mozilla {
 
 void
 GMPCrashHelperHolder::SetCrashHelper(GMPCrashHelper* aHelper)
 {
   mCrashHelper = aHelper;
 }
@@ -23,14 +23,15 @@ GMPCrashHelperHolder::GetCrashHelper()
 {
   return mCrashHelper;
 }
 
 void
 GMPCrashHelperHolder::MaybeDisconnect(bool aAbnormalShutdown)
 {
   if (!aAbnormalShutdown) {
-    RefPtr<gmp::GeckoMediaPluginService> service(gmp::GeckoMediaPluginService::GetGeckoMediaPluginService());
+    RefPtr<gmp::GeckoMediaPluginService> service(
+      gmp::GeckoMediaPluginService::GetGeckoMediaPluginService());
     service->DisconnectCrashHelper(GetCrashHelper());
   }
 }
 
 } // namespace mozilla
--- a/dom/media/gmp/GMPDecryptorChild.cpp
+++ b/dom/media/gmp/GMPDecryptorChild.cpp
@@ -53,18 +53,18 @@ GMPDecryptorChild::CallOnGMPThread(Metho
 {
   if (ON_GMP_THREAD()) {
     // Use forwarding reference when we can.
     CallMethod(aMethod, Forward<ParamType>(aParams)...);
   } else {
     // Use const reference when we have to.
     auto m = &GMPDecryptorChild::CallMethod<
         decltype(aMethod), typename AddConstReference<ParamType>::Type...>;
-    RefPtr<mozilla::Runnable> t =
-      dont_add_new_uses_of_this::NewRunnableMethod(this, m, aMethod, Forward<ParamType>(aParams)...);
+    RefPtr<mozilla::Runnable> t = dont_add_new_uses_of_this::NewRunnableMethod(
+      this, m, aMethod, Forward<ParamType>(aParams)...);
     mPlugin->GMPMessageLoop()->PostTask(t.forget());
   }
 }
 
 void
 GMPDecryptorChild::Init(GMPDecryptor* aSession)
 {
   MOZ_ASSERT(aSession);
@@ -100,17 +100,19 @@ GMPDecryptorChild::ResolvePromise(uint32
 
 void
 GMPDecryptorChild::RejectPromise(uint32_t aPromiseId,
                                  GMPDOMException aException,
                                  const char* aMessage,
                                  uint32_t aMessageLength)
 {
   CALL_ON_GMP_THREAD(SendRejectPromise,
-                     aPromiseId, aException, nsCString(aMessage, aMessageLength));
+                     aPromiseId,
+                     aException,
+                     nsCString(aMessage, aMessageLength));
 }
 
 void
 GMPDecryptorChild::SessionMessage(const char* aSessionId,
                                   uint32_t aSessionIdLength,
                                   GMPSessionMessageType aMessageType,
                                   const uint8_t* aMessage,
                                   uint32_t aMessageLength)
@@ -188,20 +190,18 @@ GMPDecryptorChild::BatchedKeyStatusChang
 }
 
 void
 GMPDecryptorChild::Decrypted(GMPBuffer* aBuffer, GMPErr aResult)
 {
   if (!ON_GMP_THREAD()) {
     // We should run this whole method on the GMP thread since the buffer needs
     // to be deleted after the SendDecrypted call.
-    mPlugin->GMPMessageLoop()->PostTask(NewRunnableMethod
-                                        <GMPBuffer*, GMPErr>(this,
-                                                             &GMPDecryptorChild::Decrypted,
-                                                             aBuffer, aResult));
+    mPlugin->GMPMessageLoop()->PostTask(NewRunnableMethod<GMPBuffer*, GMPErr>(
+      this, &GMPDecryptorChild::Decrypted, aBuffer, aResult));
     return;
   }
 
   if (!aBuffer) {
     NS_WARNING("GMPDecryptorCallback passed bull GMPBuffer");
     return;
   }
 
@@ -220,17 +220,18 @@ GMPDecryptorChild::SetCapabilities(uint6
 
 mozilla::ipc::IPCResult
 GMPDecryptorChild::RecvInit(const bool& aDistinctiveIdentifierRequired,
                             const bool& aPersistentStateRequired)
 {
   if (!mSession) {
     return IPC_FAIL_NO_REASON(this);
   }
-  mSession->Init(this, aDistinctiveIdentifierRequired, aPersistentStateRequired);
+  mSession->Init(
+    this, aDistinctiveIdentifierRequired, aPersistentStateRequired);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPDecryptorChild::RecvCreateSession(const uint32_t& aCreateSessionToken,
                                      const uint32_t& aPromiseId,
                                      const nsCString& aInitDataType,
                                      InfallibleTArray<uint8_t>&& aInitData,
@@ -310,18 +311,19 @@ GMPDecryptorChild::RecvRemoveSession(con
   mSession->RemoveSession(aPromiseId,
                           aSessionId.get(),
                           aSessionId.Length());
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-GMPDecryptorChild::RecvSetServerCertificate(const uint32_t& aPromiseId,
-                                            InfallibleTArray<uint8_t>&& aServerCert)
+GMPDecryptorChild::RecvSetServerCertificate(
+  const uint32_t& aPromiseId,
+  InfallibleTArray<uint8_t>&& aServerCert)
 {
   if (!mSession) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   mSession->SetServerCertificate(aPromiseId,
                                  aServerCert.Elements(),
                                  aServerCert.Length());
@@ -339,17 +341,18 @@ GMPDecryptorChild::RecvDecrypt(const uin
     return IPC_FAIL_NO_REASON(this);
   }
 
   // Note: the GMPBufferImpl created here is deleted when the GMP passes
   // it back in the Decrypted() callback above.
   GMPBufferImpl* buffer = new GMPBufferImpl(aId, aBuffer);
 
   // |metadata| lifetime is managed by |buffer|.
-  GMPEncryptedBufferDataImpl* metadata = new GMPEncryptedBufferDataImpl(aMetadata);
+  GMPEncryptedBufferDataImpl* metadata =
+    new GMPEncryptedBufferDataImpl(aMetadata);
   buffer->SetMetadata(metadata);
 
   mSession->Decrypt(buffer, metadata, aDurationUsecs);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPDecryptorChild::RecvDecryptingComplete()
--- a/dom/media/gmp/GMPDecryptorChild.h
+++ b/dom/media/gmp/GMPDecryptorChild.h
@@ -1,20 +1,20 @@
 /* -*- 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 GMPDecryptorChild_h_
 #define GMPDecryptorChild_h_
 
-#include "mozilla/gmp/PGMPDecryptorChild.h"
+#include "GMPEncryptedBufferDataImpl.h"
 #include "gmp-decryption.h"
 #include "mozilla/gmp/GMPTypes.h"
-#include "GMPEncryptedBufferDataImpl.h"
+#include "mozilla/gmp/PGMPDecryptorChild.h"
 #include <string>
 
 namespace mozilla {
 namespace gmp {
 
 class GMPContentChild;
 
 class GMPDecryptorChild : public GMPDecryptorCallback
@@ -74,46 +74,52 @@ public:
                                uint32_t aSessionIdLength,
                                const GMPMediaKeyInfo* aKeyInfos,
                                uint32_t aKeyInfosLength) override;
 
 private:
   ~GMPDecryptorChild();
 
   // GMPDecryptorChild
-  mozilla::ipc::IPCResult RecvInit(const bool& aDistinctiveIdentifierRequired,
-                                   const bool& aPersistentStateRequired) override;
+  mozilla::ipc::IPCResult RecvInit(
+    const bool& aDistinctiveIdentifierRequired,
+    const bool& aPersistentStateRequired) override;
 
-  mozilla::ipc::IPCResult RecvCreateSession(const uint32_t& aCreateSessionToken,
-                                            const uint32_t& aPromiseId,
-                                            const nsCString& aInitDataType,
-                                            InfallibleTArray<uint8_t>&& aInitData,
-                                            const GMPSessionType& aSessionType) override;
+  mozilla::ipc::IPCResult RecvCreateSession(
+    const uint32_t& aCreateSessionToken,
+    const uint32_t& aPromiseId,
+    const nsCString& aInitDataType,
+    InfallibleTArray<uint8_t>&& aInitData,
+    const GMPSessionType& aSessionType) override;
 
   mozilla::ipc::IPCResult RecvLoadSession(const uint32_t& aPromiseId,
                                           const nsCString& aSessionId) override;
 
-  mozilla::ipc::IPCResult RecvUpdateSession(const uint32_t& aPromiseId,
-                                            const nsCString& aSessionId,
-                                            InfallibleTArray<uint8_t>&& aResponse) override;
+  mozilla::ipc::IPCResult RecvUpdateSession(
+    const uint32_t& aPromiseId,
+    const nsCString& aSessionId,
+    InfallibleTArray<uint8_t>&& aResponse) override;
 
-  mozilla::ipc::IPCResult RecvCloseSession(const uint32_t& aPromiseId,
-                                           const nsCString& aSessionId) override;
+  mozilla::ipc::IPCResult RecvCloseSession(
+    const uint32_t& aPromiseId,
+    const nsCString& aSessionId) override;
 
-  mozilla::ipc::IPCResult RecvRemoveSession(const uint32_t& aPromiseId,
-                                            const nsCString& aSessionId) override;
+  mozilla::ipc::IPCResult RecvRemoveSession(
+    const uint32_t& aPromiseId,
+    const nsCString& aSessionId) override;
 
   mozilla::ipc::IPCResult RecvDecrypt(const uint32_t& aId,
                                       InfallibleTArray<uint8_t>&& aBuffer,
                                       const GMPDecryptionData& aMetadata,
                                       const uint64_t& aDurationUsecs) override;
 
   // Resolve/reject promise on completion.
-  mozilla::ipc::IPCResult RecvSetServerCertificate(const uint32_t& aPromiseId,
-                                                   InfallibleTArray<uint8_t>&& aServerCert) override;
+  mozilla::ipc::IPCResult RecvSetServerCertificate(
+    const uint32_t& aPromiseId,
+    InfallibleTArray<uint8_t>&& aServerCert) override;
 
   mozilla::ipc::IPCResult RecvDecryptingComplete() override;
 
   template <typename MethodType, typename... ParamType>
   void CallMethod(MethodType, ParamType&&...);
 
   template<typename MethodType, typename... ParamType>
   void CallOnGMPThread(MethodType, ParamType&&...);
--- a/dom/media/gmp/GMPDecryptorParent.cpp
+++ b/dom/media/gmp/GMPDecryptorParent.cpp
@@ -72,26 +72,31 @@ GMPDecryptorParent::Init(GMPDecryptorPro
 
 void
 GMPDecryptorParent::CreateSession(uint32_t aCreateSessionToken,
                                   uint32_t aPromiseId,
                                   const nsCString& aInitDataType,
                                   const nsTArray<uint8_t>& aInitData,
                                   GMPSessionType aSessionType)
 {
-  LOGD(("GMPDecryptorParent[%p]::CreateSession(token=%u, promiseId=%u, aInitData='%s')",
-        this, aCreateSessionToken, aPromiseId, ToHexString(aInitData).get()));
+  LOGD(("GMPDecryptorParent[%p]::CreateSession(token=%u, promiseId=%u, "
+        "aInitData='%s')",
+        this,
+        aCreateSessionToken,
+        aPromiseId,
+        ToHexString(aInitData).get()));
 
   if (!mIsOpen) {
     NS_WARNING("Trying to use a dead GMP decrypter!");
     return;
   }
   // Caller should ensure parameters passed in from JS are valid.
   MOZ_ASSERT(!aInitDataType.IsEmpty() && !aInitData.IsEmpty());
-  Unused << SendCreateSession(aCreateSessionToken, aPromiseId, aInitDataType, aInitData, aSessionType);
+  Unused << SendCreateSession(
+    aCreateSessionToken, aPromiseId, aInitDataType, aInitData, aSessionType);
 }
 
 void
 GMPDecryptorParent::LoadSession(uint32_t aPromiseId,
                                 const nsCString& aSessionId)
 {
   LOGD(("GMPDecryptorParent[%p]::LoadSession(sessionId='%s', promiseId=%u)",
         this, aSessionId.get(), aPromiseId));
@@ -104,18 +109,22 @@ GMPDecryptorParent::LoadSession(uint32_t
   Unused << SendLoadSession(aPromiseId, aSessionId);
 }
 
 void
 GMPDecryptorParent::UpdateSession(uint32_t aPromiseId,
                                   const nsCString& aSessionId,
                                   const nsTArray<uint8_t>& aResponse)
 {
-  LOGD(("GMPDecryptorParent[%p]::UpdateSession(sessionId='%s', promiseId=%u response='%s')",
-        this, aSessionId.get(), aPromiseId, ToHexString(aResponse).get()));
+  LOGD(("GMPDecryptorParent[%p]::UpdateSession(sessionId='%s', promiseId=%u "
+        "response='%s')",
+        this,
+        aSessionId.get(),
+        aPromiseId,
+        ToHexString(aResponse).get()));
 
   if (!mIsOpen) {
     NS_WARNING("Trying to use a dead GMP decrypter!");
     return;
   }
   // Caller should ensure parameters passed in from JS are valid.
   MOZ_ASSERT(!aSessionId.IsEmpty() && !aResponse.IsEmpty());
   Unused << SendUpdateSession(aPromiseId, aSessionId, aResponse);
@@ -238,85 +247,117 @@ GMPDecryptorParent::RecvResolvePromise(c
   if (!mIsOpen) {
     NS_WARNING("Trying to use a dead GMP decrypter!");
     return IPC_FAIL_NO_REASON(this);
   }
   mCallback->ResolvePromise(aPromiseId);
   return IPC_OK();
 }
 
-nsresult
-GMPExToNsresult(GMPDOMException aDomException) {
+static nsresult
+GMPExToNsresult(GMPDOMException aDomException)
+{
   switch (aDomException) {
-    case kGMPNoModificationAllowedError: return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
-    case kGMPNotFoundError: return NS_ERROR_DOM_NOT_FOUND_ERR;
-    case kGMPNotSupportedError: return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
-    case kGMPInvalidStateError: return NS_ERROR_DOM_INVALID_STATE_ERR;
-    case kGMPSyntaxError: return NS_ERROR_DOM_SYNTAX_ERR;
-    case kGMPInvalidModificationError: return NS_ERROR_DOM_INVALID_MODIFICATION_ERR;
-    case kGMPInvalidAccessError: return NS_ERROR_DOM_INVALID_ACCESS_ERR;
-    case kGMPSecurityError: return NS_ERROR_DOM_SECURITY_ERR;
-    case kGMPAbortError: return NS_ERROR_DOM_ABORT_ERR;
-    case kGMPQuotaExceededError: return NS_ERROR_DOM_QUOTA_EXCEEDED_ERR;
-    case kGMPTimeoutError: return NS_ERROR_DOM_TIMEOUT_ERR;
-    case kGMPTypeError: return NS_ERROR_DOM_TYPE_ERR;
-    default: return NS_ERROR_DOM_UNKNOWN_ERR;
+    case kGMPNoModificationAllowedError:
+      return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
+    case kGMPNotFoundError:
+      return NS_ERROR_DOM_NOT_FOUND_ERR;
+    case kGMPNotSupportedError:
+      return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
+    case kGMPInvalidStateError:
+      return NS_ERROR_DOM_INVALID_STATE_ERR;
+    case kGMPSyntaxError:
+      return NS_ERROR_DOM_SYNTAX_ERR;
+    case kGMPInvalidModificationError:
+      return NS_ERROR_DOM_INVALID_MODIFICATION_ERR;
+    case kGMPInvalidAccessError:
+      return NS_ERROR_DOM_INVALID_ACCESS_ERR;
+    case kGMPSecurityError:
+      return NS_ERROR_DOM_SECURITY_ERR;
+    case kGMPAbortError:
+      return NS_ERROR_DOM_ABORT_ERR;
+    case kGMPQuotaExceededError:
+      return NS_ERROR_DOM_QUOTA_EXCEEDED_ERR;
+    case kGMPTimeoutError:
+      return NS_ERROR_DOM_TIMEOUT_ERR;
+    case kGMPTypeError:
+      return NS_ERROR_DOM_TYPE_ERR;
+    default:
+      return NS_ERROR_DOM_UNKNOWN_ERR;
   }
 }
 
 mozilla::ipc::IPCResult
 GMPDecryptorParent::RecvRejectPromise(const uint32_t& aPromiseId,
                                       const GMPDOMException& aException,
                                       const nsCString& aMessage)
 {
-  LOGD(("GMPDecryptorParent[%p]::RecvRejectPromise(promiseId=%u, exception=%d, msg='%s')",
-        this, aPromiseId, aException, aMessage.get()));
+  LOGD(("GMPDecryptorParent[%p]::RecvRejectPromise(promiseId=%u, exception=%d, "
+        "msg='%s')",
+        this,
+        aPromiseId,
+        aException,
+        aMessage.get()));
 
   if (!mIsOpen) {
     NS_WARNING("Trying to use a dead GMP decrypter!");
     return IPC_FAIL_NO_REASON(this);
   }
   mCallback->RejectPromise(aPromiseId, GMPExToNsresult(aException), aMessage);
   return IPC_OK();
 }
 
 
 static dom::MediaKeyMessageType
 ToMediaKeyMessageType(GMPSessionMessageType aMessageType) {
   switch (aMessageType) {
-    case kGMPLicenseRequest: return dom::MediaKeyMessageType::License_request;
-    case kGMPLicenseRenewal: return dom::MediaKeyMessageType::License_renewal;
-    case kGMPLicenseRelease: return dom::MediaKeyMessageType::License_release;
-    case kGMPIndividualizationRequest: return dom::MediaKeyMessageType::Individualization_request;
-    default: return dom::MediaKeyMessageType::License_request;
+    case kGMPLicenseRequest:
+      return dom::MediaKeyMessageType::License_request;
+    case kGMPLicenseRenewal:
+      return dom::MediaKeyMessageType::License_renewal;
+    case kGMPLicenseRelease:
+      return dom::MediaKeyMessageType::License_release;
+    case kGMPIndividualizationRequest:
+      return dom::MediaKeyMessageType::Individualization_request;
+    default:
+      return dom::MediaKeyMessageType::License_request;
   };
 };
 
 mozilla::ipc::IPCResult
-GMPDecryptorParent::RecvSessionMessage(const nsCString& aSessionId,
-                                       const GMPSessionMessageType& aMessageType,
-                                       nsTArray<uint8_t>&& aMessage)
+GMPDecryptorParent::RecvSessionMessage(
+  const nsCString& aSessionId,
+  const GMPSessionMessageType& aMessageType,
+  nsTArray<uint8_t>&& aMessage)
 {
-  LOGD(("GMPDecryptorParent[%p]::RecvSessionMessage(sessionId='%s', type=%d, msg='%s')",
-        this, aSessionId.get(), aMessageType, ToHexString(aMessage).get()));
+  LOGD(("GMPDecryptorParent[%p]::RecvSessionMessage(sessionId='%s', type=%d, "
+        "msg='%s')",
+        this,
+        aSessionId.get(),
+        aMessageType,
+        ToHexString(aMessage).get()));
 
   if (!mIsOpen) {
     NS_WARNING("Trying to use a dead GMP decrypter!");
     return IPC_FAIL_NO_REASON(this);
   }
-  mCallback->SessionMessage(aSessionId, ToMediaKeyMessageType(aMessageType), aMessage);
+  mCallback->SessionMessage(
+    aSessionId, ToMediaKeyMessageType(aMessageType), aMessage);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPDecryptorParent::RecvExpirationChange(const nsCString& aSessionId,
                                          const double& aExpiryTime)
 {
-  LOGD(("GMPDecryptorParent[%p]::RecvExpirationChange(sessionId='%s', expiry=%lf)",
-        this, aSessionId.get(), aExpiryTime));
+  LOGD(
+    ("GMPDecryptorParent[%p]::RecvExpirationChange(sessionId='%s', expiry=%lf)",
+     this,
+     aSessionId.get(),
+     aExpiryTime));
 
   if (!mIsOpen) {
     NS_WARNING("Trying to use a dead GMP decrypter!");
     return IPC_FAIL_NO_REASON(this);
   }
   mCallback->ExpirationChange(aSessionId, aExpiryTime);
   return IPC_OK();
 }
@@ -336,19 +377,23 @@ GMPDecryptorParent::RecvSessionClosed(co
 }
 
 mozilla::ipc::IPCResult
 GMPDecryptorParent::RecvSessionError(const nsCString& aSessionId,
                                      const GMPDOMException& aException,
                                      const uint32_t& aSystemCode,
                                      const nsCString& aMessage)
 {
-  LOGD(("GMPDecryptorParent[%p]::RecvSessionError(sessionId='%s', exception=%d, sysCode=%d, msg='%s')",
-        this, aSessionId.get(),
-        aException, aSystemCode, aMessage.get()));
+  LOGD(("GMPDecryptorParent[%p]::RecvSessionError(sessionId='%s', "
+        "exception=%d, sysCode=%d, msg='%s')",
+        this,
+        aSessionId.get(),
+        aException,
+        aSystemCode,
+        aMessage.get()));
 
   if (!mIsOpen) {
     NS_WARNING("Trying to use a dead GMP decrypter!");
     return IPC_FAIL_NO_REASON(this);
   }
   mCallback->SessionError(aSessionId,
                           GMPExToNsresult(aException),
                           aSystemCode,
@@ -366,42 +411,50 @@ ToMediaKeyStatus(GMPMediaKeyStatus aStat
     case kGMPInternalError: return dom::MediaKeyStatus::Internal_error;
     case kGMPReleased: return dom::MediaKeyStatus::Released;
     case kGMPStatusPending: return dom::MediaKeyStatus::Status_pending;
     default: return dom::MediaKeyStatus::Internal_error;
   }
 }
 
 mozilla::ipc::IPCResult
-GMPDecryptorParent::RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
-                                                InfallibleTArray<GMPKeyInformation>&& aKeyInfos)
+GMPDecryptorParent::RecvBatchedKeyStatusChanged(
+  const nsCString& aSessionId,
+  InfallibleTArray<GMPKeyInformation>&& aKeyInfos)
 {
-  LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(sessionId='%s', KeyInfos len='%d')",
-        this, aSessionId.get(), aKeyInfos.Length()));
+  LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(sessionId='%s', "
+        "KeyInfos len='%d')",
+        this,
+        aSessionId.get(),
+        aKeyInfos.Length()));
 
   if (mIsOpen) {
     nsTArray<CDMKeyInfo> cdmKeyInfos(aKeyInfos.Length());
-    for (uint32_t i = 0; i < aKeyInfos.Length(); i++) {
-      LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(keyId=%s, gmp-status=%d)",
-            this, ToHexString(aKeyInfos[i].keyId()).get(), aKeyInfos[i].status()));
-      // If the status is kGMPUnknown, we're going to forget(remove) that key info.
-      if (aKeyInfos[i].status() != kGMPUnknown) {
-        auto status = ToMediaKeyStatus(aKeyInfos[i].status());
-        cdmKeyInfos.AppendElement(CDMKeyInfo(aKeyInfos[i].keyId(),
-                                             dom::Optional<dom::MediaKeyStatus>(status)));
+    for (const auto& info : aKeyInfos) {
+      LOGD(("GMPDecryptorParent[%p]::RecvBatchedKeyStatusChanged(keyId=%s, "
+            "gmp-status=%d)",
+            this,
+            ToHexString(info.keyId()).get(),
+            info.status()));
+      // If the status is kGMPUnknown, we're going to forget(remove) that key
+      // info.
+      if (info.status() != kGMPUnknown) {
+        auto status = ToMediaKeyStatus(info.status());
+        cdmKeyInfos.AppendElement(CDMKeyInfo(
+          info.keyId(), dom::Optional<dom::MediaKeyStatus>(status)));
       } else {
-        cdmKeyInfos.AppendElement(CDMKeyInfo(aKeyInfos[i].keyId()));
+        cdmKeyInfos.AppendElement(CDMKeyInfo(info.keyId()));
       }
     }
     mCallback->BatchedKeyStatusChanged(aSessionId, cdmKeyInfos);
   }
   return IPC_OK();
 }
 
-DecryptStatus
+static DecryptStatus
 ToDecryptStatus(GMPErr aError)
 {
   switch (aError) {
     case GMPNoErr: return Ok;
     case GMPNoKeyErr: return NoKeyErr;
     case GMPAbortedErr: return AbortedErr;
     default: return GenericErr;
   }
--- a/dom/media/gmp/GMPDecryptorParent.h
+++ b/dom/media/gmp/GMPDecryptorParent.h
@@ -1,21 +1,21 @@
 /* -*- 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 GMPDecryptorParent_h_
 #define GMPDecryptorParent_h_
 
-#include "mozilla/gmp/PGMPDecryptorParent.h"
-#include "mozilla/RefPtr.h"
+#include "GMPCrashHelperHolder.h"
+#include "GMPDecryptorProxy.h"
 #include "gmp-decryption.h"
-#include "GMPDecryptorProxy.h"
-#include "GMPCrashHelperHolder.h"
+#include "mozilla/RefPtr.h"
+#include "mozilla/gmp/PGMPDecryptorParent.h"
 
 namespace mozilla {
 
 class CryptoSample;
 
 namespace gmp {
 
 class GMPContentParent;
@@ -70,48 +70,56 @@ public:
 
 private:
   ~GMPDecryptorParent();
 
   // PGMPDecryptorParent
 
   mozilla::ipc::IPCResult RecvSetDecryptorId(const uint32_t& aId) override;
 
-  mozilla::ipc::IPCResult RecvSetSessionId(const uint32_t& aCreateSessionToken,
-                                           const nsCString& aSessionId) override;
+  mozilla::ipc::IPCResult RecvSetSessionId(
+    const uint32_t& aCreateSessionToken,
+    const nsCString& aSessionId) override;
 
-  mozilla::ipc::IPCResult RecvResolveLoadSessionPromise(const uint32_t& aPromiseId,
-                                                        const bool& aSuccess) override;
+  mozilla::ipc::IPCResult RecvResolveLoadSessionPromise(
+    const uint32_t& aPromiseId,
+    const bool& aSuccess) override;
 
-  mozilla::ipc::IPCResult RecvResolvePromise(const uint32_t& aPromiseId) override;
+  mozilla::ipc::IPCResult RecvResolvePromise(
+    const uint32_t& aPromiseId) override;
 
   mozilla::ipc::IPCResult RecvRejectPromise(const uint32_t& aPromiseId,
                                             const GMPDOMException& aException,
                                             const nsCString& aMessage) override;
 
-  mozilla::ipc::IPCResult RecvSessionMessage(const nsCString& aSessionId,
-                                             const GMPSessionMessageType& aMessageType,
-                                             nsTArray<uint8_t>&& aMessage) override;
+  mozilla::ipc::IPCResult RecvSessionMessage(
+    const nsCString& aSessionId,
+    const GMPSessionMessageType& aMessageType,
+    nsTArray<uint8_t>&& aMessage) override;
 
-  mozilla::ipc::IPCResult RecvExpirationChange(const nsCString& aSessionId,
-                                               const double& aExpiryTime) override;
+  mozilla::ipc::IPCResult RecvExpirationChange(
+    const nsCString& aSessionId,
+    const double& aExpiryTime) override;
 
-  mozilla::ipc::IPCResult RecvSessionClosed(const nsCString& aSessionId) override;
+  mozilla::ipc::IPCResult RecvSessionClosed(
+    const nsCString& aSessionId) override;
 
   mozilla::ipc::IPCResult RecvSessionError(const nsCString& aSessionId,
                                            const GMPDOMException& aException,
                                            const uint32_t& aSystemCode,
                                            const nsCString& aMessage) override;
 
-  mozilla::ipc::IPCResult RecvDecrypted(const uint32_t& aId,
-                                        const GMPErr& aErr,
-                                        InfallibleTArray<uint8_t>&& aBuffer) override;
+  mozilla::ipc::IPCResult RecvDecrypted(
+    const uint32_t& aId,
+    const GMPErr& aErr,
+    InfallibleTArray<uint8_t>&& aBuffer) override;
 
-  mozilla::ipc::IPCResult RecvBatchedKeyStatusChanged(const nsCString& aSessionId,
-                                                      InfallibleTArray<GMPKeyInformation>&& aKeyInfos) override;
+  mozilla::ipc::IPCResult RecvBatchedKeyStatusChanged(
+    const nsCString& aSessionId,
+    InfallibleTArray<GMPKeyInformation>&& aKeyInfos) override;
 
   mozilla::ipc::IPCResult RecvShutdown() override;
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
   mozilla::ipc::IPCResult Recv__delete__() override;
 
   bool mIsOpen;
   bool mShuttingDown;
--- a/dom/media/gmp/GMPDecryptorProxy.h
+++ b/dom/media/gmp/GMPDecryptorProxy.h
@@ -1,29 +1,30 @@
 /* -*- 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 "mozilla/DecryptorProxyCallback.h"
 #include "nsString.h"
 
 namespace mozilla {
 class CryptoSample;
 } // namespace mozilla
 
 class GMPDecryptorProxyCallback : public DecryptorProxyCallback,
-                                  public GMPCallbackBase {
+                                  public GMPCallbackBase
+{
 public:
-  virtual ~GMPDecryptorProxyCallback() {}
+  virtual ~GMPDecryptorProxyCallback() { }
 };
 
 class GMPDecryptorProxy {
 public:
   ~GMPDecryptorProxy() {}
 
   virtual uint32_t GetPluginId() const = 0;
 
--- a/dom/media/gmp/GMPDiskStorage.cpp
+++ b/dom/media/gmp/GMPDiskStorage.cpp
@@ -1,27 +1,27 @@
 /* -*- 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/. */
 
-#include "plhash.h"
-#include "nsDirectoryServiceUtils.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsAppDirectoryServiceDefs.h"
 #include "GMPParent.h"
 #include "gmp-storage.h"
-#include "mozilla/Unused.h"
+#include "mozIGeckoMediaPluginService.h"
 #include "mozilla/EndianUtils.h"
+#include "mozilla/Unused.h"
+#include "nsAppDirectoryServiceDefs.h"
 #include "nsClassHashtable.h"
+#include "nsContentCID.h"
+#include "nsDirectoryServiceDefs.h"
+#include "nsDirectoryServiceUtils.h"
+#include "nsISimpleEnumerator.h"
+#include "nsServiceManagerUtils.h"
+#include "plhash.h"
 #include "prio.h"
-#include "mozIGeckoMediaPluginService.h"
-#include "nsContentCID.h"
-#include "nsServiceManagerUtils.h"
-#include "nsISimpleEnumerator.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
 extern LogModule* GetGMPLog();
@@ -91,40 +91,44 @@ GetGMPStorageDir(nsIFile** aTempDir,
 
 // Disk-backed GMP storage. Records are stored in files on disk in
 // the profile directory. The record name is a hash of the filename,
 // and we resolve hash collisions by just adding 1 to the hash code.
 // The format of records on disk is:
 //   4 byte, uint32_t $recordNameLength, in little-endian byte order,
 //   record name (i.e. $recordNameLength bytes, no null terminator)
 //   record bytes (entire remainder of file)
-class GMPDiskStorage : public GMPStorage {
+class GMPDiskStorage : public GMPStorage
+{
 public:
   explicit GMPDiskStorage(const nsCString& aNodeId,
                           const nsString& aGMPName)
     : mNodeId(aNodeId)
     , mGMPName(aGMPName)
   {
   }
 
-  ~GMPDiskStorage() {
+  ~GMPDiskStorage()
+  {
     // Close all open file handles.
     for (auto iter = mRecords.ConstIter(); !iter.Done(); iter.Next()) {
       Record* record = iter.UserData();
       if (record->mFileDesc) {
         PR_Close(record->mFileDesc);
         record->mFileDesc = nullptr;
       }
     }
   }
 
-  nsresult Init() {
+  nsresult Init()
+  {
     // Build our index of records on disk.
     nsCOMPtr<nsIFile> storageDir;
-    nsresult rv = GetGMPStorageDir(getter_AddRefs(storageDir), mGMPName, mNodeId);
+    nsresult rv =
+      GetGMPStorageDir(getter_AddRefs(storageDir), mGMPName, mNodeId);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return NS_ERROR_FAILURE;
     }
 
     DirectoryEnumerator iter(storageDir, DirectoryEnumerator::FilesAndDirs);
     for (nsCOMPtr<nsIFile> dirEntry; (dirEntry = iter.Next()) != nullptr;) {
       PRFileDesc* fd = nullptr;
       if (NS_FAILED(dirEntry->OpenNSPRFileDesc(PR_RDONLY, 0, &fd))) {
@@ -180,17 +184,18 @@ public:
       return GMPGenericErr;
     }
 
     MOZ_ASSERT(IsOpen(aRecordName));
 
     return GMPNoErr;
   }
 
-  bool IsOpen(const nsCString& aRecordName) const override {
+  bool IsOpen(const nsCString& aRecordName) const override
+  {
     // We are open if we have a record indexed, and it has a valid
     // file descriptor.
     const Record* record = mRecords.Get(aRecordName);
     return record && !!record->mFileDesc;
   }
 
   GMPErr Read(const nsCString& aRecordName,
               nsTArray<uint8_t>& aOutBytes) override
@@ -229,17 +234,18 @@ public:
     // After calling ReadRecordMetadata, we should be ready to read the
     // record data.
     if (PR_Available(record->mFileDesc) != recordLength) {
       NS_WARNING("Record file length mismatch!");
       return GMPRecordCorrupted;
     }
 
     aOutBytes.SetLength(recordLength);
-    int32_t bytesRead = PR_Read(record->mFileDesc, aOutBytes.Elements(), recordLength);
+    int32_t bytesRead =
+      PR_Read(record->mFileDesc, aOutBytes.Elements(), recordLength);
     return (bytesRead == recordLength) ? GMPNoErr : GMPRecordCorrupted;
   }
 
   GMPErr Write(const nsCString& aRecordName,
                const nsTArray<uint8_t>& aBytes) override
   {
     if (!IsOpen(aRecordName)) {
       return GMPClosedErr;
@@ -422,23 +428,26 @@ private:
     recordName.SetLength(recordNameLength);
     bytesRead = PR_Read(aFd, recordName.BeginWriting(), recordNameLength);
     if ((uint32_t)bytesRead != recordNameLength) {
       // Read failed.
       return NS_ERROR_FAILURE;
     }
 
     MOZ_ASSERT(fileLength >= sizeof(recordNameLength) + recordNameLength);
-    int32_t recordLength = fileLength - (sizeof(recordNameLength) + recordNameLength);
+    int32_t recordLength =
+      fileLength - (sizeof(recordNameLength) + recordNameLength);
 
     aOutRecordLength = recordLength;
     aOutRecordName = recordName;
 
-    // Read cursor should be positioned after the record name, before the record contents.
-    if (PR_Seek(aFd, 0, PR_SEEK_CUR) != (int32_t)(sizeof(recordNameLength) + recordNameLength)) {
+    // Read cursor should be positioned after the record name, before the record
+    // contents.
+    if (PR_Seek(aFd, 0, PR_SEEK_CUR)
+        != (int32_t)(sizeof(recordNameLength) + recordNameLength)) {
       NS_WARNING("Read cursor mismatch after ReadRecordMetadata()");
       return NS_ERROR_FAILURE;
     }
 
     return NS_OK;
   }
 
   nsresult RemoveStorageFile(const nsString& aFilename)
@@ -450,24 +459,27 @@ private:
     }
     rv = f->Append(aFilename);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
     return f->Remove(/* bool recursive= */ false);
   }
 
-  struct Record {
+  struct Record
+  {
     Record(const nsAString& aFilename,
            const nsACString& aRecordName)
       : mFilename(aFilename)
       , mRecordName(aRecordName)
       , mFileDesc(0)
-    {}
-    ~Record() {
+    {
+    }
+    ~Record()
+    {
       MOZ_ASSERT(!mFileDesc);
     }
     nsString mFilename;
     nsCString mRecordName;
     PRFileDesc* mFileDesc;
   };
 
   // Hash record name to record data.
--- a/dom/media/gmp/GMPEncryptedBufferDataImpl.cpp
+++ b/dom/media/gmp/GMPEncryptedBufferDataImpl.cpp
@@ -1,30 +1,32 @@
 /* -*- 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/. */
 
 #include "GMPEncryptedBufferDataImpl.h"
+#include "MediaData.h"
 #include "mozilla/gmp/GMPTypes.h"
-#include "MediaData.h"
 
 namespace mozilla {
 namespace gmp {
 
-GMPEncryptedBufferDataImpl::GMPEncryptedBufferDataImpl(const CryptoSample& aCrypto)
+GMPEncryptedBufferDataImpl::GMPEncryptedBufferDataImpl(
+  const CryptoSample& aCrypto)
   : mKeyId(aCrypto.mKeyId)
   , mIV(aCrypto.mIV)
   , mClearBytes(aCrypto.mPlainSizes)
   , mCipherBytes(aCrypto.mEncryptedSizes)
   , mSessionIdList(aCrypto.mSessionIds)
 {
 }
 
-GMPEncryptedBufferDataImpl::GMPEncryptedBufferDataImpl(const GMPDecryptionData& aData)
+GMPEncryptedBufferDataImpl::GMPEncryptedBufferDataImpl(
+  const GMPDecryptionData& aData)
   : mKeyId(aData.mKeyId())
   , mIV(aData.mIV())
   , mClearBytes(aData.mClearBytes())
   , mCipherBytes(aData.mCipherBytes())
   , mSessionIdList(aData.mSessionIds())
 {
   MOZ_ASSERT(mClearBytes.Length() == mCipherBytes.Length());
 }
--- a/dom/media/gmp/GMPEncryptedBufferDataImpl.h
+++ b/dom/media/gmp/GMPEncryptedBufferDataImpl.h
@@ -2,19 +2,19 @@
 /* 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 GMPEncryptedBufferDataImpl_h_
 #define GMPEncryptedBufferDataImpl_h_
 
 #include "gmp-decryption.h"
+#include "mozilla/gmp/GMPTypes.h"
 #include "nsAutoPtr.h"
 #include "nsTArray.h"
-#include "mozilla/gmp/GMPTypes.h"
 
 namespace mozilla {
 class CryptoSample;
 
 namespace gmp {
 
 class GMPStringListImpl : public GMPStringList
 {
@@ -25,17 +25,18 @@ public:
                 const char** aOutString, uint32_t *aOutLength) const override;
   virtual ~GMPStringListImpl() override;
   void RelinquishData(nsTArray<nsCString>& aStrings);
 
 private:
   nsTArray<nsCString> mStrings;
 };
 
-class GMPEncryptedBufferDataImpl : public GMPEncryptedBufferMetadata {
+class GMPEncryptedBufferDataImpl : public GMPEncryptedBufferMetadata
+{
 public:
   explicit GMPEncryptedBufferDataImpl(const CryptoSample& aCrypto);
   explicit GMPEncryptedBufferDataImpl(const GMPDecryptionData& aData);
   virtual ~GMPEncryptedBufferDataImpl();
 
   void RelinquishData(GMPDecryptionData& aData);
 
   const uint8_t* KeyId() const override;
@@ -51,38 +52,44 @@ private:
   nsTArray<uint8_t> mKeyId;
   nsTArray<uint8_t> mIV;
   nsTArray<uint16_t> mClearBytes;
   nsTArray<uint32_t> mCipherBytes;
 
   GMPStringListImpl mSessionIdList;
 };
 
-class GMPBufferImpl : public GMPBuffer {
+class GMPBufferImpl : public GMPBuffer
+{
 public:
   GMPBufferImpl(uint32_t aId, const nsTArray<uint8_t>& aData)
     : mId(aId)
     , mData(aData)
   {
   }
-  uint32_t Id() const override {
+  uint32_t Id() const override
+  {
     return mId;
   }
-  uint8_t* Data() override {
+  uint8_t* Data() override
+  {
     return mData.Elements();
   }
-  uint32_t Size() const override {
+  uint32_t Size() const override
+  {
     return mData.Length();
   }
-  void Resize(uint32_t aSize) override {
+  void Resize(uint32_t aSize) override
+  {
     mData.SetLength(aSize);
   }
 
   // Set metadata object to be freed when this buffer is destroyed.
-  void SetMetadata(GMPEncryptedBufferDataImpl* aMetadata) {
+  void SetMetadata(GMPEncryptedBufferDataImpl* aMetadata)
+  {
     mMetadata = aMetadata;
   }
 
   uint32_t mId;
   nsTArray<uint8_t> mData;
   nsAutoPtr<GMPEncryptedBufferDataImpl> mMetadata;
 };
 
--- a/dom/media/gmp/GMPLoader.cpp
+++ b/dom/media/gmp/GMPLoader.cpp
@@ -1,81 +1,86 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: sw=4 ts=4 et :
  * 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/. */
 
 #include "GMPLoader.h"
-#include <stdio.h>
+#include "gmp-entrypoints.h"
 #include "mozilla/Attributes.h"
-#include "gmp-entrypoints.h"
-#include "prlink.h"
-#include "prenv.h"
 #if defined(XP_WIN) && defined(MOZ_SANDBOX)
 #include "mozilla/sandboxTarget.h"
 #include "mozilla/sandboxing/SandboxInitialization.h"
 #include "mozilla/sandboxing/sandboxLogging.h"
 #endif
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
 #include "mozilla/Sandbox.h"
 #include "mozilla/SandboxInfo.h"
 #endif
-
+#include "prenv.h"
+#include "prlink.h"
+#include <stdio.h>
 #include <string>
 
 #ifdef XP_WIN
 #include "windows.h"
 #endif
 
 namespace mozilla {
 namespace gmp {
-class PassThroughGMPAdapter : public GMPAdapter {
+class PassThroughGMPAdapter : public GMPAdapter
+{
 public:
-  ~PassThroughGMPAdapter() override {
-    // Ensure we're always shutdown, even if caller forgets to call GMPShutdown().
-    GMPShutdown();
+  ~PassThroughGMPAdapter() override
+   {
+     // Ensure we're always shutdown, even if caller forgets to call
+     // GMPShutdown().
+     GMPShutdown();
   }
 
   void SetAdaptee(PRLibrary* aLib) override
   {
     mLib = aLib;
   }
 
   GMPErr GMPInit(const GMPPlatformAPI* aPlatformAPI) override
   {
     if (!mLib) {
       return GMPGenericErr;
     }
-    GMPInitFunc initFunc = reinterpret_cast<GMPInitFunc>(PR_FindFunctionSymbol(mLib, "GMPInit"));
+    GMPInitFunc initFunc =
+      reinterpret_cast<GMPInitFunc>(PR_FindFunctionSymbol(mLib, "GMPInit"));
     if (!initFunc) {
       return GMPNotImplementedErr;
     }
     return initFunc(aPlatformAPI);
   }
 
   GMPErr GMPGetAPI(const char* aAPIName,
                    void* aHostAPI,
                    void** aPluginAPI,
                    uint32_t aDecryptorId) override
   {
     if (!mLib) {
       return GMPGenericErr;
     }
-    GMPGetAPIFunc getapiFunc = reinterpret_cast<GMPGetAPIFunc>(PR_FindFunctionSymbol(mLib, "GMPGetAPI"));
+    GMPGetAPIFunc getapiFunc =
+      reinterpret_cast<GMPGetAPIFunc>(PR_FindFunctionSymbol(mLib, "GMPGetAPI"));
     if (!getapiFunc) {
       return GMPNotImplementedErr;
     }
     return getapiFunc(aAPIName, aHostAPI, aPluginAPI);
   }
 
   void GMPShutdown() override
   {
     if (mLib) {
-      GMPShutdownFunc shutdownFunc = reinterpret_cast<GMPShutdownFunc>(PR_FindFunctionSymbol(mLib, "GMPShutdown"));
+      GMPShutdownFunc shutdownFunc = reinterpret_cast<GMPShutdownFunc>(
+        PR_FindFunctionSymbol(mLib, "GMPShutdown"));
       if (shutdownFunc) {
         shutdownFunc();
       }
       PR_UnloadLibrary(mLib);
       mLib = nullptr;
     }
   }
 
@@ -97,17 +102,18 @@ GMPLoader::Load(const char* aUTF8LibPath
   PRLibSpec libSpec;
 #ifdef XP_WIN
   int pathLen = MultiByteToWideChar(CP_UTF8, 0, aUTF8LibPath, -1, nullptr, 0);
   if (pathLen == 0) {
     return false;
   }
 
   auto widePath = MakeUnique<wchar_t[]>(pathLen);
-  if (MultiByteToWideChar(CP_UTF8, 0, aUTF8LibPath, -1, widePath.get(), pathLen) == 0) {
+  if (MultiByteToWideChar(CP_UTF8, 0, aUTF8LibPath, -1, widePath.get(), pathLen)
+      == 0) {
     return false;
   }
 
   libSpec.value.pathname_u = widePath.get();
   libSpec.type = PR_LibSpec_PathnameU;
 #else
   libSpec.value.pathname = aUTF8LibPath;
   libSpec.type = PR_LibSpec_Pathname;
@@ -189,17 +195,18 @@ private:
 #endif
 
 #if defined (XP_LINUX) && defined(MOZ_GMP_SANDBOX)
 namespace {
 class LinuxSandboxStarter : public mozilla::gmp::SandboxStarter
 {
 private:
   LinuxSandboxStarter() { }
-  friend mozilla::detail::UniqueSelector<LinuxSandboxStarter>::SingleObject mozilla::MakeUnique<LinuxSandboxStarter>();
+  friend mozilla::detail::UniqueSelector<LinuxSandboxStarter>::SingleObject
+  mozilla::MakeUnique<LinuxSandboxStarter>();
 
 public:
   static UniquePtr<SandboxStarter> Make()
   {
     if (mozilla::SandboxInfo::Get().CanSandboxMedia()) {
       return MakeUnique<LinuxSandboxStarter>();
     }
     // Sandboxing isn't possible, but the parent has already
--- a/dom/media/gmp/GMPLoader.h
+++ b/dom/media/gmp/GMPLoader.h
@@ -2,44 +2,46 @@
  * vim: sw=4 ts=4 et :
  * 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 GMP_LOADER_H__
 #define GMP_LOADER_H__
 
-#include <stdint.h>
-#include "prlink.h"
 #include "gmp-entrypoints.h"
 #include "mozilla/UniquePtr.h"
+#include "prlink.h"
+#include <stdint.h>
 
 #if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
 #include "mozilla/Sandbox.h"
 #endif
 
 namespace mozilla {
 namespace gmp {
 
-class SandboxStarter {
+class SandboxStarter
+{
 public:
-  virtual ~SandboxStarter() {}
+  virtual ~SandboxStarter() { }
   virtual bool Start(const char* aLibPath) = 0;
 #if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
   // On OS X we need to set Mac-specific sandbox info just before we start the
   // sandbox, which we don't yet know when the GMPLoader and SandboxStarter
   // objects are created.
   virtual void SetSandboxInfo(MacSandboxInfo* aSandboxInfo) = 0;
 #endif
 };
 
 // Interface that adapts a plugin to the GMP API.
-class GMPAdapter {
+class GMPAdapter
+{
 public:
-  virtual ~GMPAdapter() {}
+  virtual ~GMPAdapter() { }
   // Sets the adapted to plugin library module.
   // Note: the GMPAdapter is responsible for calling PR_UnloadLibrary on aLib
   // when it's finished with it.
   virtual void SetAdaptee(PRLibrary* aLib) = 0;
 
   // These are called in place of the corresponding GMP API functions.
   virtual GMPErr GMPInit(const GMPPlatformAPI* aPlatformAPI) = 0;
   virtual GMPErr GMPGetAPI(const char* aAPIName,
@@ -47,17 +49,18 @@ public:
                            void** aPluginAPI,
                            uint32_t aDecryptorId) = 0;
   virtual void GMPShutdown() = 0;
 };
 
 // Encapsulates activating the sandbox, and loading the GMP.
 // Load() takes an optional GMPAdapter which can be used to adapt non-GMPs
 // to adhere to the GMP API.
-class GMPLoader {
+class GMPLoader
+{
 public:
   GMPLoader();
 
   // Activates the sandbox, then loads the GMP library. If aAdapter is
   // non-null, the lib path is assumed to be a non-GMP, and the adapter
   // is initialized with the lib and the adapter is used to interact with
   // the plugin.
   bool Load(const char* aUTF8LibPath,
--- a/dom/media/gmp/GMPMemoryStorage.cpp
+++ b/dom/media/gmp/GMPMemoryStorage.cpp
@@ -4,32 +4,34 @@
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GMPStorage.h"
 #include "nsClassHashtable.h"
 
 namespace mozilla {
 namespace gmp {
 
-class GMPMemoryStorage : public GMPStorage {
+class GMPMemoryStorage : public GMPStorage
+{
 public:
   GMPErr Open(const nsCString& aRecordName) override
   {
     MOZ_ASSERT(!IsOpen(aRecordName));
 
     Record* record = nullptr;
     if (!mRecords.Get(aRecordName, &record)) {
       record = new Record();
       mRecords.Put(aRecordName, record);
     }
     record->mIsOpen = true;
     return GMPNoErr;
   }
 
-  bool IsOpen(const nsCString& aRecordName) const override {
+  bool IsOpen(const nsCString& aRecordName) const override
+  {
     const Record* record = mRecords.Get(aRecordName);
     if (!record) {
       return false;
     }
     return record->mIsOpen;
   }
 
   GMPErr Read(const nsCString& aRecordName,
@@ -65,17 +67,18 @@ public:
       mRecords.Remove(aRecordName);
     } else {
       record->mIsOpen = false;
     }
   }
 
 private:
 
-  struct Record {
+  struct Record
+  {
     nsTArray<uint8_t> mData;
     bool mIsOpen = false;
   };
 
   nsClassHashtable<nsCStringHashKey, Record> mRecords;
 };
 
 already_AddRefed<GMPStorage> CreateGMPMemoryStorage()
--- a/dom/media/gmp/GMPMessageUtils.h
+++ b/dom/media/gmp/GMPMessageUtils.h
@@ -7,24 +7,24 @@
 #define GMPMessageUtils_h_
 
 #include "gmp-video-codec.h"
 #include "gmp-video-frame-encoded.h"
 #include "gmp-decryption.h"
 
 namespace IPC {
 
-template <>
+template<>
 struct ParamTraits<GMPErr>
-: public ContiguousEnumSerializer<GMPErr,
-                                  GMPNoErr,
-                                  GMPLastErr>
-{};
+  : public ContiguousEnumSerializer<GMPErr, GMPNoErr, GMPLastErr>
+{
+};
 
-struct GMPDomExceptionValidator {
+struct GMPDomExceptionValidator
+{
   static bool IsLegalValue(GMPDOMException aValue) {
     switch (aValue) {
       case kGMPNoModificationAllowedError:
       case kGMPNotFoundError:
       case kGMPNotSupportedError:
       case kGMPInvalidStateError:
       case kGMPSyntaxError:
       case kGMPInvalidModificationError:
@@ -36,83 +36,93 @@ struct GMPDomExceptionValidator {
       case kGMPTypeError:
         return true;
       default:
         return false;
     }
   }
 };
 
-template <>
+template<>
 struct ParamTraits<GMPVideoFrameType>
-: public ContiguousEnumSerializer<GMPVideoFrameType,
-                                  kGMPKeyFrame,
-                                  kGMPVideoFrameInvalid>
-{};
+  : public ContiguousEnumSerializer<GMPVideoFrameType,
+                                    kGMPKeyFrame,
+                                    kGMPVideoFrameInvalid>
+{
+};
 
 template<>
 struct ParamTraits<GMPDOMException>
-: public EnumSerializer<GMPDOMException, GMPDomExceptionValidator>
-{};
+  : public EnumSerializer<GMPDOMException, GMPDomExceptionValidator>
+{
+};
 
-template <>
+template<>
 struct ParamTraits<GMPSessionMessageType>
-: public ContiguousEnumSerializer<GMPSessionMessageType,
-                                  kGMPLicenseRequest,
-                                  kGMPMessageInvalid>
-{};
+  : public ContiguousEnumSerializer<GMPSessionMessageType,
+                                    kGMPLicenseRequest,
+                                    kGMPMessageInvalid>
+{
+};
 
-template <>
+template<>
 struct ParamTraits<GMPMediaKeyStatus>
-: public ContiguousEnumSerializer<GMPMediaKeyStatus,
-                                  kGMPUsable,
-                                  kGMPMediaKeyStatusInvalid>
-{};
+  : public ContiguousEnumSerializer<GMPMediaKeyStatus,
+                                    kGMPUsable,
+                                    kGMPMediaKeyStatusInvalid>
+{
+};
 
-template <>
+template<>
 struct ParamTraits<GMPSessionType>
-: public ContiguousEnumSerializer<GMPSessionType,
-                                  kGMPTemporySession,
-                                  kGMPSessionInvalid>
-{};
+  : public ContiguousEnumSerializer<GMPSessionType,
+                                    kGMPTemporySession,
+                                    kGMPSessionInvalid>
+{
+};
 
-template <>
+template<>
 struct ParamTraits<GMPVideoCodecComplexity>
-: public ContiguousEnumSerializer<GMPVideoCodecComplexity,
-                                  kGMPComplexityNormal,
-                                  kGMPComplexityInvalid>
-{};
+  : public ContiguousEnumSerializer<GMPVideoCodecComplexity,
+                                    kGMPComplexityNormal,
+                                    kGMPComplexityInvalid>
+{
+};
 
-template <>
+template<>
 struct ParamTraits<GMPVP8ResilienceMode>
-: public ContiguousEnumSerializer<GMPVP8ResilienceMode,
-                                  kResilienceOff,
-                                  kResilienceInvalid>
-{};
+  : public ContiguousEnumSerializer<GMPVP8ResilienceMode,
+                                    kResilienceOff,
+                                    kResilienceInvalid>
+{
+};
 
-template <>
+template<>
 struct ParamTraits<GMPVideoCodecType>
-: public ContiguousEnumSerializer<GMPVideoCodecType,
-                                  kGMPVideoCodecVP8,
-                                  kGMPVideoCodecInvalid>
-{};
+  : public ContiguousEnumSerializer<GMPVideoCodecType,
+                                    kGMPVideoCodecVP8,
+                                    kGMPVideoCodecInvalid>
+{
+};
 
-template <>
+template<>
 struct ParamTraits<GMPVideoCodecMode>
-: public ContiguousEnumSerializer<GMPVideoCodecMode,
-                                  kGMPRealtimeVideo,
-                                  kGMPCodecModeInvalid>
-{};
+  : public ContiguousEnumSerializer<GMPVideoCodecMode,
+                                    kGMPRealtimeVideo,
+                                    kGMPCodecModeInvalid>
+{
+};
 
-template <>
+template<>
 struct ParamTraits<GMPBufferType>
-: public ContiguousEnumSerializer<GMPBufferType,
-                                  GMP_BufferSingle,
-                                  GMP_BufferInvalid>
-{};
+  : public ContiguousEnumSerializer<GMPBufferType,
+                                    GMP_BufferSingle,
+                                    GMP_BufferInvalid>
+{
+};
 
 template <>
 struct ParamTraits<GMPSimulcastStream>
 {
   typedef GMPSimulcastStream paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
@@ -120,48 +130,56 @@ struct ParamTraits<GMPSimulcastStream>
     WriteParam(aMsg, aParam.mHeight);
     WriteParam(aMsg, aParam.mNumberOfTemporalLayers);
     WriteParam(aMsg, aParam.mMaxBitrate);
     WriteParam(aMsg, aParam.mTargetBitrate);
     WriteParam(aMsg, aParam.mMinBitrate);
     WriteParam(aMsg, aParam.mQPMax);
   }
 
-  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
+  static bool Read(const Message* aMsg,
+                   PickleIterator* aIter,
+                   paramType* aResult)
   {
-    if (ReadParam(aMsg, aIter, &(aResult->mWidth)) &&
-        ReadParam(aMsg, aIter, &(aResult->mHeight)) &&
-        ReadParam(aMsg, aIter, &(aResult->mNumberOfTemporalLayers)) &&
-        ReadParam(aMsg, aIter, &(aResult->mMaxBitrate)) &&
-        ReadParam(aMsg, aIter, &(aResult->mTargetBitrate)) &&
-        ReadParam(aMsg, aIter, &(aResult->mMinBitrate)) &&
-        ReadParam(aMsg, aIter, &(aResult->mQPMax))) {
+    if (ReadParam(aMsg, aIter, &(aResult->mWidth))
+        && ReadParam(aMsg, aIter, &(aResult->mHeight))
+        && ReadParam(aMsg, aIter, &(aResult->mNumberOfTemporalLayers))
+        && ReadParam(aMsg, aIter, &(aResult->mMaxBitrate))
+        && ReadParam(aMsg, aIter, &(aResult->mTargetBitrate))
+        && ReadParam(aMsg, aIter, &(aResult->mMinBitrate))
+        && ReadParam(aMsg, aIter, &(aResult->mQPMax))) {
       return true;
     }
     return false;
   }
 
   static void Log(const paramType& aParam, std::wstring* aLog)
   {
-    aLog->append(StringPrintf(L"[%u, %u, %u, %u, %u, %u, %u]", aParam.mWidth, aParam.mHeight,
-                              aParam.mNumberOfTemporalLayers, aParam.mMaxBitrate,
-                              aParam.mTargetBitrate, aParam.mMinBitrate, aParam.mQPMax));
+    aLog->append(StringPrintf(L"[%u, %u, %u, %u, %u, %u, %u]",
+                              aParam.mWidth,
+                              aParam.mHeight,
+                              aParam.mNumberOfTemporalLayers,
+                              aParam.mMaxBitrate,
+                              aParam.mTargetBitrate,
+                              aParam.mMinBitrate,
+                              aParam.mQPMax));
   }
 };
 
 template <>
 struct ParamTraits<GMPVideoCodec>
 {
   typedef GMPVideoCodec paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, aParam.mGMPApiVersion);
     WriteParam(aMsg, aParam.mCodecType);
-    WriteParam(aMsg, static_cast<const nsCString&>(nsDependentCString(aParam.mPLName)));
+    WriteParam(
+      aMsg, static_cast<const nsCString&>(nsDependentCString(aParam.mPLName)));
     WriteParam(aMsg, aParam.mPLType);
     WriteParam(aMsg, aParam.mWidth);
     WriteParam(aMsg, aParam.mHeight);
     WriteParam(aMsg, aParam.mStartBitrate);
     WriteParam(aMsg, aParam.mMaxBitrate);
     WriteParam(aMsg, aParam.mMinBitrate);
     WriteParam(aMsg, aParam.mMaxFramerate);
     WriteParam(aMsg, aParam.mFrameDroppingOn);
@@ -169,49 +187,53 @@ struct ParamTraits<GMPVideoCodec>
     WriteParam(aMsg, aParam.mQPMax);
     WriteParam(aMsg, aParam.mNumberOfSimulcastStreams);
     for (uint32_t i = 0; i < aParam.mNumberOfSimulcastStreams; i++) {
       WriteParam(aMsg, aParam.mSimulcastStream[i]);
     }
     WriteParam(aMsg, aParam.mMode);
   }
 
-  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
+  static bool Read(const Message* aMsg,
+                   PickleIterator* aIter,
+                   paramType* aResult)
   {
     // NOTE: make sure this matches any versions supported
-    if (!ReadParam(aMsg, aIter, &(aResult->mGMPApiVersion)) ||
-      aResult->mGMPApiVersion != kGMPVersion33) {
+    if (!ReadParam(aMsg, aIter, &(aResult->mGMPApiVersion))
+        || aResult->mGMPApiVersion != kGMPVersion33) {
         return false;
     }
     if (!ReadParam(aMsg, aIter, &(aResult->mCodecType))) {
       return false;
     }
 
     nsAutoCString plName;
-    if (!ReadParam(aMsg, aIter, &plName) ||
-        plName.Length() > kGMPPayloadNameSize - 1) {
+    if (!ReadParam(aMsg, aIter, &plName)
+        || plName.Length() > kGMPPayloadNameSize - 1) {
       return false;
     }
     memcpy(aResult->mPLName, plName.get(), plName.Length());
-    memset(aResult->mPLName + plName.Length(), 0, kGMPPayloadNameSize - plName.Length());
+    memset(aResult->mPLName + plName.Length(),
+           0,
+           kGMPPayloadNameSize - plName.Length());
 
-    if (!ReadParam(aMsg, aIter, &(aResult->mPLType)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mWidth)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mHeight)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mStartBitrate)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mMaxBitrate)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mMinBitrate)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mMaxFramerate)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mFrameDroppingOn)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mKeyFrameInterval))) {
+    if (!ReadParam(aMsg, aIter, &(aResult->mPLType))
+        || !ReadParam(aMsg, aIter, &(aResult->mWidth))
+        || !ReadParam(aMsg, aIter, &(aResult->mHeight))
+        || !ReadParam(aMsg, aIter, &(aResult->mStartBitrate))
+        || !ReadParam(aMsg, aIter, &(aResult->mMaxBitrate))
+        || !ReadParam(aMsg, aIter, &(aResult->mMinBitrate))
+        || !ReadParam(aMsg, aIter, &(aResult->mMaxFramerate))
+        || !ReadParam(aMsg, aIter, &(aResult->mFrameDroppingOn))
+        || !ReadParam(aMsg, aIter, &(aResult->mKeyFrameInterval))) {
       return false;
     }
 
-    if (!ReadParam(aMsg, aIter, &(aResult->mQPMax)) ||
-        !ReadParam(aMsg, aIter, &(aResult->mNumberOfSimulcastStreams))) {
+    if (!ReadParam(aMsg, aIter, &(aResult->mQPMax))
+        || !ReadParam(aMsg, aIter, &(aResult->mNumberOfSimulcastStreams))) {
       return false;
     }
 
     if (aResult->mNumberOfSimulcastStreams > kGMPMaxSimulcastStreams) {
       return false;
     }
 
     for (uint32_t i = 0; i < aResult->mNumberOfSimulcastStreams; i++) {
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -1,35 +1,33 @@
 /* -*- 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/. */
 
 #include "GMPParent.h"
-#include "mozilla/Logging.h"
-#include "nsComponentManagerUtils.h"
-#include "nsComponentManagerUtils.h"
-#include "nsThreadUtils.h"
-#include "nsIRunnable.h"
-#include "nsIWritablePropertyBag2.h"
+#include "GMPContentParent.h"
+#include "GMPTimerParent.h"
+#include "MediaPrefs.h"
+#include "VideoUtils.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "mozilla/AbstractThread.h"
-#include "mozilla/ipc/GeckoChildProcessHost.h"
+#include "mozilla/Logging.h"
 #include "mozilla/SSE.h"
-#include "mozilla/SyncRunnable.h"
-#include "mozilla/Unused.h"
-#include "nsIObserverService.h"
-#include "GMPTimerParent.h"
-#include "runnable_utils.h"
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
 #include "mozilla/SandboxInfo.h"
 #endif
-#include "GMPContentParent.h"
-#include "MediaPrefs.h"
-#include "VideoUtils.h"
+#include "mozilla/Unused.h"
+#include "mozilla/ipc/GeckoChildProcessHost.h"
+#include "nsComponentManagerUtils.h"
+#include "nsIObserverService.h"
+#include "nsIRunnable.h"
+#include "nsIWritablePropertyBag2.h"
+#include "nsThreadUtils.h"
+#include "runnable_utils.h"
 
 using mozilla::ipc::GeckoChildProcessHost;
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsPrintfCString.h"
 #include "mozilla/ipc/CrashReporterHost.h"
 using CrashReporter::AnnotationTable;
 using CrashReporter::GetIDFromMinidump;
@@ -120,17 +118,19 @@ GMPParent::Init(GeckoMediaPluginServiceP
   if (NS_FAILED(rv)) {
     return GenericPromise::CreateAndReject(rv, __func__);
   }
   nsAutoString parentLeafName;
   rv = parent->GetLeafName(parentLeafName);
   if (NS_FAILED(rv)) {
     return GenericPromise::CreateAndReject(rv, __func__);
   }
-  LOGD("%s: for %s", __FUNCTION__, NS_LossyConvertUTF16toASCII(parentLeafName).get());
+  LOGD("%s: for %s",
+       __FUNCTION__,
+       NS_LossyConvertUTF16toASCII(parentLeafName).get());
 
   MOZ_ASSERT(parentLeafName.Length() > 4);
   mName = Substring(parentLeafName, 4);
 
   return ReadGMPMetaData();
 }
 
 void
@@ -178,17 +178,19 @@ GMPParent::LoadProcess()
 
 #ifdef XP_WIN
     if (!mLibs.IsEmpty()) {
       bool ok = SendPreloadLibs(mLibs);
       if (!ok) {
         LOGD("%s: Failed to send preload-libs to child process", __FUNCTION__);
         return NS_ERROR_FAILURE;
       }
-      LOGD("%s: Sent preload-libs ('%s') to child process", __FUNCTION__, mLibs.get());
+      LOGD("%s: Sent preload-libs ('%s') to child process",
+           __FUNCTION__,
+           mLibs.get());
     }
 #endif
 
     // Intr call to block initialization on plugin load.
     if (!CallStartPlugin(mAdapter)) {
       LOGD("%s: Failed to send start to child process", __FUNCTION__);
       return NS_ERROR_FAILURE;
     }
@@ -302,17 +304,18 @@ GMPParent::Shutdown()
 class NotifyGMPShutdownTask : public Runnable {
 public:
   explicit NotifyGMPShutdownTask(const nsAString& aNodeId)
     : mNodeId(aNodeId)
   {
   }
   NS_IMETHOD Run() override {
     MOZ_ASSERT(NS_IsMainThread());
-    nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
+    nsCOMPtr<nsIObserverService> obsService =
+      mozilla::services::GetObserverService();
     MOZ_ASSERT(obsService);
     if (obsService) {
       obsService->NotifyObservers(nullptr, "gmp-shutdown", mNodeId.get());
     }
     return NS_OK;
   }
   nsString mNodeId;
 };
@@ -370,17 +373,18 @@ GMPParent::State() const
   return mState;
 }
 
 // Not changing to use mService since we'll be removing it
 nsIThread*
 GMPParent::GMPThread()
 {
   if (!mGMPThread) {
-    nsCOMPtr<mozIGeckoMediaPluginService> mps = do_GetService("@mozilla.org/gecko-media-plugin-service;1");
+    nsCOMPtr<mozIGeckoMediaPluginService> mps =
+      do_GetService("@mozilla.org/gecko-media-plugin-service;1");
     MOZ_ASSERT(mps);
     if (!mps) {
       return nullptr;
     }
     // Not really safe if we just grab to the mGMPThread, as we don't know
     // what thread we're running on and other threads may be trying to
     // access this without locks!  However, debug only, and primary failure
     // mode outside of compiler-helped TSAN is a leak.  But better would be
@@ -439,32 +443,34 @@ GMPCapability::Supports(const nsTArray<G
 }
 
 bool
 GMPParent::EnsureProcessLoaded()
 {
   if (mState == GMPStateLoaded) {
     return true;
   }
-  if (mState == GMPStateClosing ||
-      mState == GMPStateUnloading) {
+  if (mState == GMPStateClosing
+      || mState == GMPStateUnloading) {
     return false;
   }
 
   nsresult rv = LoadProcess();
 
   return NS_SUCCEEDED(rv);
 }
 
 #ifdef MOZ_CRASHREPORTER
 void
 GMPParent::WriteExtraDataForMinidump()
 {
-  mCrashReporter->AddNote(NS_LITERAL_CSTRING("GMPPlugin"), NS_LITERAL_CSTRING("1"));
-  mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginFilename"), NS_ConvertUTF16toUTF8(mName));
+  mCrashReporter->AddNote(NS_LITERAL_CSTRING("GMPPlugin"),
+                          NS_LITERAL_CSTRING("1"));
+  mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginFilename"),
+                          NS_ConvertUTF16toUTF8(mName));
   mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginName"), mDisplayName);
   mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginVersion"), mVersion);
 }
 
 bool
 GMPParent::GetCrashID(nsString& aResult)
 {
   if (!mCrashReporter) {
@@ -476,25 +482,29 @@ GMPParent::GetCrashID(nsString& aResult)
     return false;
   }
 
   aResult = mCrashReporter->MinidumpID();
   return true;
 }
 
 static void
-GMPNotifyObservers(const uint32_t aPluginID, const nsACString& aPluginName, const nsAString& aPluginDumpID)
+GMPNotifyObservers(const uint32_t aPluginID,
+                   const nsACString& aPluginName,
+                   const nsAString& aPluginDumpID)
 {
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
   nsCOMPtr<nsIWritablePropertyBag2> propbag =
     do_CreateInstance("@mozilla.org/hash-property-bag;1");
   if (obs && propbag) {
     propbag->SetPropertyAsUint32(NS_LITERAL_STRING("pluginID"), aPluginID);
-    propbag->SetPropertyAsACString(NS_LITERAL_STRING("pluginName"), aPluginName);
-    propbag->SetPropertyAsAString(NS_LITERAL_STRING("pluginDumpID"), aPluginDumpID);
+    propbag->SetPropertyAsACString(NS_LITERAL_STRING("pluginName"),
+                                   aPluginName);
+    propbag->SetPropertyAsAString(NS_LITERAL_STRING("pluginDumpID"),
+                                  aPluginDumpID);
     obs->NotifyObservers(propbag, "gmp-plugin-crash", nullptr);
   }
 
   RefPtr<gmp::GeckoMediaPluginService> service =
     gmp::GeckoMediaPluginService::GetGeckoMediaPluginService();
   if (service) {
     service->RunPluginCrashCallbacks(aPluginID, aPluginName);
   }
@@ -535,17 +545,18 @@ GMPParent::ActorDestroy(ActorDestroyReas
     MOZ_ASSERT(mState == GMPStateClosing);
     DeleteProcess();
     // Note: final destruction will be Dispatched to ourself
     mService->ReAddOnGMPThread(self);
   }
 }
 
 mozilla::ipc::IPCResult
-GMPParent::RecvInitCrashReporter(Shmem&& aShmem, const NativeThreadId& aThreadId)
+GMPParent::RecvInitCrashReporter(Shmem&& aShmem,
+                                 const NativeThreadId& aThreadId)
 {
 #ifdef MOZ_CRASHREPORTER
   mCrashReporter = MakeUnique<ipc::CrashReporterHost>(
     GeckoProcessType_GMPlugin,
     aShmem,
     aThreadId);
 #endif
   return IPC_OK();
@@ -597,17 +608,19 @@ GMPParent::DeallocPGMPTimerParent(PGMPTi
 {
   GMPTimerParent* p = static_cast<GMPTimerParent*>(aActor);
   p->Shutdown();
   mTimers.RemoveElement(p);
   return true;
 }
 
 bool
-ReadInfoField(GMPInfoFileParser& aParser, const nsCString& aKey, nsACString& aOutValue)
+ReadInfoField(GMPInfoFileParser& aParser,
+              const nsCString& aKey,
+              nsACString& aOutValue)
 {
   if (!aParser.Contains(aKey) || aParser.Get(aKey).IsEmpty()) {
     return false;
   }
   aOutValue = aParser.Get(aKey);
   return true;
 }
 
@@ -642,20 +655,20 @@ RefPtr<GenericPromise>
 GMPParent::ReadGMPInfoFile(nsIFile* aFile)
 {
   GMPInfoFileParser parser;
   if (!parser.Init(aFile)) {
     return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
   }
 
   nsAutoCString apis;
-  if (!ReadInfoField(parser, NS_LITERAL_CSTRING("name"), mDisplayName) ||
-      !ReadInfoField(parser, NS_LITERAL_CSTRING("description"), mDescription) ||
-      !ReadInfoField(parser, NS_LITERAL_CSTRING("version"), mVersion) ||
-      !ReadInfoField(parser, NS_LITERAL_CSTRING("apis"), apis)) {
+  if (!ReadInfoField(parser, NS_LITERAL_CSTRING("name"), mDisplayName)
+      || !ReadInfoField(parser, NS_LITERAL_CSTRING("description"), mDescription)
+      || !ReadInfoField(parser, NS_LITERAL_CSTRING("version"), mVersion)
+      || !ReadInfoField(parser, NS_LITERAL_CSTRING("apis"), apis)) {
     return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
   }
 
 #ifdef XP_WIN
   // "Libraries" field is optional.
   ReadInfoField(parser, NS_LITERAL_CSTRING("libraries"), mLibs);
 #endif
 
@@ -678,17 +691,18 @@ GMPParent::ReadGMPInfoFile(nsIFile* aFil
       if (tagsEnd == -1 || tagsEnd < tagsStart) {
         // Invalid syntax, skip whole capability.
         continue;
       }
 
       cap.mAPIName.Assign(Substring(api, 0, tagsStart));
 
       if ((tagsEnd - tagsStart) > 1) {
-        const nsDependentCSubstring ts(Substring(api, tagsStart + 1, tagsEnd - tagsStart - 1));
+        const nsDependentCSubstring ts(
+          Substring(api, tagsStart + 1, tagsEnd - tagsStart - 1));
         nsTArray<nsCString> tagTokens;
         SplitAt(":", ts, tagTokens);
         for (nsCString tag : tagTokens) {
           cap.mAPITags.AppendElement(tag);
         }
       }
     }
 
@@ -769,17 +783,18 @@ GMPParent::ParseChromiumManifest(const n
 
   nsCString kEMEKeySystem;
 
   // We hard code a few of the settings because they can't be stored in the
   // widevine manifest without making our API different to widevine's.
   if (mDisplayName.EqualsASCII("clearkey")) {
     kEMEKeySystem = kEMEKeySystemClearkey;
 #if XP_WIN
-    mLibs = NS_LITERAL_CSTRING("dxva2.dll, msmpeg2vdec.dll, evr.dll, mfh264dec.dll, mfplat.dll");
+    mLibs = NS_LITERAL_CSTRING(
+      "dxva2.dll, msmpeg2vdec.dll, evr.dll, mfh264dec.dll, mfplat.dll");
 #endif
   } else if (mDisplayName.EqualsASCII("WidevineCdm")) {
     kEMEKeySystem = kEMEKeySystemWidevine;
 #if XP_WIN
     mLibs = NS_LITERAL_CSTRING("dxva2.dll");
 #endif
   } else {
     return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
@@ -817,22 +832,22 @@ GMPParent::ParseChromiumManifest(const n
   mAdapter = NS_LITERAL_STRING("widevine");
 
   return GenericPromise::CreateAndResolve(true, __func__);
 }
 
 bool
 GMPParent::CanBeSharedCrossNodeIds() const
 {
-  return mNodeId.IsEmpty() &&
+  return mNodeId.IsEmpty()
          // XXX bug 1159300 hack -- maybe remove after openh264 1.4
          // We don't want to use CDM decoders for non-encrypted playback
          // just yet; especially not for WebRTC. Don't allow CDMs to be used
          // without a node ID.
-         !mCanDecrypt;
+         && !mCanDecrypt;
 }
 
 bool
 GMPParent::CanBeUsedFrom(const nsACString& aNodeId) const
 {
   return mNodeId == aNodeId;
 }
 
@@ -862,17 +877,18 @@ GMPParent::GetPluginId() const
 }
 
 void
 GMPParent::ResolveGetContentParentPromises()
 {
   nsTArray<UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>>> promises;
   promises.SwapElements(mGetContentParentPromises);
   MOZ_ASSERT(mGetContentParentPromises.IsEmpty());
-  RefPtr<GMPContentParent::CloseBlocker> blocker(new GMPContentParent::CloseBlocker(mGMPContentParent));
+  RefPtr<GMPContentParent::CloseBlocker> blocker(
+    new GMPContentParent::CloseBlocker(mGMPContentParent));
   for (auto& holder : promises) {
     holder->Resolve(blocker, __func__);
   }
 }
 
 bool
 GMPParent::OpenPGMPContent()
 {
@@ -908,31 +924,34 @@ GMPParent::RejectGetContentParentPromise
   promises.SwapElements(mGetContentParentPromises);
   MOZ_ASSERT(mGetContentParentPromises.IsEmpty());
   for (auto& holder : promises) {
     holder->Reject(NS_ERROR_FAILURE, __func__);
   }
 }
 
 void
-GMPParent::GetGMPContentParent(UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>>&& aPromiseHolder)
+GMPParent::GetGMPContentParent(
+  UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>>&& aPromiseHolder)
 {
   LOGD("%s %p", __FUNCTION__, this);
   MOZ_ASSERT(GMPThread() == NS_GetCurrentThread());
 
   if (mGMPContentParent) {
-    RefPtr<GMPContentParent::CloseBlocker> blocker(new GMPContentParent::CloseBlocker(mGMPContentParent));
+    RefPtr<GMPContentParent::CloseBlocker> blocker(
+      new GMPContentParent::CloseBlocker(mGMPContentParent));
     aPromiseHolder->Resolve(blocker, __func__);
   } else {
     mGetContentParentPromises.AppendElement(Move(aPromiseHolder));
     // If we don't have a GMPContentParent and we try to get one for the first
-    // time (mGetContentParentPromises.Length() == 1) then call PGMPContent::Open. If more
-    // calls to GetGMPContentParent happen before mGMPContentParent has been
-    // set then we should just store them, so that they get called when we set
-    // mGMPContentParent as a result of the PGMPContent::Open call.
+    // time (mGetContentParentPromises.Length() == 1) then call
+    // PGMPContent::Open. If more calls to GetGMPContentParent happen before
+    // mGMPContentParent has been set then we should just store them, so that
+    // they get called when we set mGMPContentParent as a result of the
+    // PGMPContent::Open call.
     if (mGetContentParentPromises.Length() == 1) {
       if (!EnsureProcessLoaded() || !OpenPGMPContent()) {
         RejectGetContentParentPromises();
         return;
       }
       // We want to increment this as soon as possible, to avoid that we'd try
       // to shut down the GMP process while we're still trying to get a
       // PGMPContentParent actor.
--- a/dom/media/gmp/GMPParent.h
+++ b/dom/media/gmp/GMPParent.h
@@ -1,86 +1,89 @@
 /* -*- 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 GMPParent_h_
 #define GMPParent_h_
 
+#include "GMPDecryptorParent.h"
 #include "GMPProcessParent.h"
 #include "GMPServiceParent.h"
-#include "GMPDecryptorParent.h"
+#include "GMPStorageParent.h"
+#include "GMPTimerParent.h"
 #include "GMPVideoDecoderParent.h"
 #include "GMPVideoEncoderParent.h"
-#include "GMPTimerParent.h"
-#include "GMPStorageParent.h"
+#include "mozilla/MozPromise.h"
 #include "mozilla/gmp/PGMPParent.h"
 #include "nsCOMPtr.h"
-#include "nscore.h"
+#include "nsIFile.h"
 #include "nsISupports.h"
 #include "nsString.h"
 #include "nsTArray.h"
-#include "nsIFile.h"
-#include "mozilla/MozPromise.h"
+#include "nscore.h"
 
 class nsIThread;
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #endif
 
 namespace mozilla {
 namespace ipc {
 class CrashReporterHost;
 } // namespace ipc
 namespace gmp {
 
 class GMPCapability
 {
 public:
-  explicit GMPCapability() {}
+  GMPCapability() { }
   GMPCapability(GMPCapability&& aOther)
     : mAPIName(Move(aOther.mAPIName))
     , mAPITags(Move(aOther.mAPITags))
   {
   }
   explicit GMPCapability(const nsCString& aAPIName)
     : mAPIName(aAPIName)
-  {}
+  {
+  }
   explicit GMPCapability(const GMPCapability& aOther) = default;
   nsCString mAPIName;
   nsTArray<nsCString> mAPITags;
 
   static bool Supports(const nsTArray<GMPCapability>& aCapabilities,
                        const nsCString& aAPI,
                        const nsTArray<nsCString>& aTags);
 
   static bool Supports(const nsTArray<GMPCapability>& aCapabilities,
                        const nsCString& aAPI,
                        const nsCString& aTag);
 };
 
-enum GMPState {
+enum GMPState
+{
   GMPStateNotLoaded,
   GMPStateLoaded,
   GMPStateUnloading,
   GMPStateClosing
 };
 
 class GMPContentParent;
 
 class GMPParent final : public PGMPParent
 {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPParent)
 
   GMPParent();
 
-  RefPtr<GenericPromise> Init(GeckoMediaPluginServiceParent* aService, nsIFile* aPluginDir);
+  RefPtr<GenericPromise> Init(GeckoMediaPluginServiceParent* aService,
+                              nsIFile* aPluginDir);
   nsresult CloneFrom(const GMPParent* aOther);
 
   void Crash();
 
   nsresult LoadProcess();
 
   // Called internally to close this if we don't need it
   void CloseIfUnused();
@@ -126,66 +129,75 @@ public:
   // Returns true if a plugin can be or is being used across multiple NodeIds.
   bool CanBeSharedCrossNodeIds() const;
 
   // A GMP can be used from a NodeId if it's already been set to work with
   // that NodeId, or if it's not been set to work with any NodeId and has
   // not yet been loaded (i.e. it's not shared across NodeIds).
   bool CanBeUsedFrom(const nsACString& aNodeId) const;
 
-  already_AddRefed<nsIFile> GetDirectory() {
+  already_AddRefed<nsIFile> GetDirectory()
+  {
     return nsCOMPtr<nsIFile>(mDirectory).forget();
   }
 
   void AbortAsyncShutdown();
 
   // Called when the child process has died.
   void ChildTerminated();
 
   bool OpenPGMPContent();
 
-  void GetGMPContentParent(UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>>&& aPromiseHolder);
+  void GetGMPContentParent(
+    UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>>&& aPromiseHolder);
   already_AddRefed<GMPContentParent> ForgetGMPContentParent();
 
   bool EnsureProcessLoaded(base::ProcessId* aID);
 
   void IncrementGMPContentChildCount();
 
-  const nsTArray<GMPCapability>& GetCapabilities() const { return mCapabilities; }
+  const nsTArray<GMPCapability>& GetCapabilities() const
+  {
+    return mCapabilities;
+  }
 
 private:
   ~GMPParent();
 
   RefPtr<GeckoMediaPluginServiceParent> mService;
   bool EnsureProcessLoaded();
   RefPtr<GenericPromise> ReadGMPMetaData();
   RefPtr<GenericPromise> ReadGMPInfoFile(nsIFile* aFile);
   RefPtr<GenericPromise> ParseChromiumManifest(const nsAString& aJSON); // Main thread.
   RefPtr<GenericPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread.
 #ifdef MOZ_CRASHREPORTER
   void WriteExtraDataForMinidump();
   bool GetCrashID(nsString& aResult);
 #endif
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
-  mozilla::ipc::IPCResult RecvInitCrashReporter(Shmem&& shmem, const NativeThreadId& aThreadId) override;
+  mozilla::ipc::IPCResult RecvInitCrashReporter(
+    Shmem&& shmem,
+    const NativeThreadId& aThreadId) override;
 
-  mozilla::ipc::IPCResult RecvPGMPStorageConstructor(PGMPStorageParent* actor) override;
+  mozilla::ipc::IPCResult RecvPGMPStorageConstructor(
+    PGMPStorageParent* actor) override;
   PGMPStorageParent* AllocPGMPStorageParent() override;
   bool DeallocPGMPStorageParent(PGMPStorageParent* aActor) override;
 
-  mozilla::ipc::IPCResult RecvPGMPTimerConstructor(PGMPTimerParent* actor) override;
+  mozilla::ipc::IPCResult RecvPGMPTimerConstructor(
+    PGMPTimerParent* actor) override;
   PGMPTimerParent* AllocPGMPTimerParent() override;
   bool DeallocPGMPTimerParent(PGMPTimerParent* aActor) override;
 
   mozilla::ipc::IPCResult RecvPGMPContentChildDestroyed() override;
   bool IsUsed()
   {
-    return mGMPContentChildCount > 0 ||
-           !mGetContentParentPromises.IsEmpty();
+    return mGMPContentChildCount > 0
+           || !mGetContentParentPromises.IsEmpty();
   }
 
   void ResolveGetContentParentPromises();
   void RejectGetContentParentPromises();
 
   GMPState mState;
   nsCOMPtr<nsIFile> mDirectory; // plugin directory on disk
   nsString mName; // base name of plugin on disk, UTF-16 because used for paths
@@ -209,17 +221,18 @@ private:
   nsTArray<RefPtr<GMPStorageParent>> mStorage;
   nsCOMPtr<nsIThread> mGMPThread;
   // NodeId the plugin is assigned to, or empty if the the plugin is not
   // assigned to a NodeId.
   nsCString mNodeId;
   // This is used for GMP content in the parent, there may be more of these in
   // the content processes.
   RefPtr<GMPContentParent> mGMPContentParent;
-  nsTArray<UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>>> mGetContentParentPromises;
+  nsTArray<UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>>>
+    mGetContentParentPromises;
   uint32_t mGMPContentChildCount;
 
   int mChildPid;
 
   // We hold a self reference to ourself while the child process is alive.
   // This ensures that if the GMPService tries to shut us down and drops
   // its reference to us, we stay alive long enough for the child process
   // to terminate gracefully.
--- a/dom/media/gmp/GMPPlatform.cpp
+++ b/dom/media/gmp/GMPPlatform.cpp
@@ -1,20 +1,20 @@
 /* -*- 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/. */
 
 #include "GMPPlatform.h"
+#include "GMPChild.h"
 #include "GMPStorageChild.h"
 #include "GMPTimerChild.h"
+#include "base/thread.h"
 #include "mozilla/Monitor.h"
-#include "GMPChild.h"
 #include "mozilla/Mutex.h"
-#include "base/thread.h"
 #include "mozilla/ReentrantMonitor.h"
 
 #include <ctime>
 
 namespace mozilla {
 namespace gmp {
 
 static MessageLoop* sMainLoop = nullptr;
@@ -28,46 +28,44 @@ IsOnChildMainThread()
 
 // We just need a refcounted wrapper for GMPTask objects.
 class GMPRunnable final
 {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPRunnable)
 
   explicit GMPRunnable(GMPTask* aTask)
-  : mTask(aTask)
+    : mTask(aTask)
   {
     MOZ_ASSERT(mTask);
   }
 
   void Run()
   {
     mTask->Run();
     mTask->Destroy();
     mTask = nullptr;
   }
 
 private:
-  ~GMPRunnable()
-  {
-  }
+  ~GMPRunnable() { }
 
   GMPTask* mTask;
 };
 
 class GMPSyncRunnable final
 {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPSyncRunnable)
 
   GMPSyncRunnable(GMPTask* aTask, MessageLoop* aMessageLoop)
-  : mDone(false)
-  , mTask(aTask)
-  , mMessageLoop(aMessageLoop)
-  , mMonitor("GMPSyncRunnable")
+    : mDone(false)
+    , mTask(aTask)
+    , mMessageLoop(aMessageLoop)
+    , mMonitor("GMPSyncRunnable")
   {
     MOZ_ASSERT(mTask);
     MOZ_ASSERT(mMessageLoop);
   }
 
   void Post()
   {
     // We assert here for two reasons.
@@ -89,19 +87,17 @@ public:
     mTask->Destroy();
     mTask = nullptr;
     MonitorAutoLock lock(mMonitor);
     mDone = true;
     lock.Notify();
   }
 
 private:
-  ~GMPSyncRunnable()
-  {
-  }
+  ~GMPSyncRunnable() { }
 
   bool mDone;
   GMPTask* mTask;
   MessageLoop* mMessageLoop;
   Monitor mMonitor;
 };
 
 class GMPThreadImpl : public GMPThread
@@ -186,18 +182,18 @@ CreateMutex(GMPMutex** aMutex)
 }
 
 GMPErr
 CreateRecord(const char* aRecordName,
              uint32_t aRecordNameSize,
              GMPRecord** aOutRecord,
              GMPRecordClient* aClient)
 {
-  if (aRecordNameSize > GMP_MAX_RECORD_NAME_SIZE ||
-      aRecordNameSize == 0) {
+  if (aRecordNameSize > GMP_MAX_RECORD_NAME_SIZE
+      || aRecordNameSize == 0) {
     NS_WARNING("GMP tried to CreateRecord with too long or 0 record name");
     return GMPGenericErr;
   }
   GMPStorageChild* storage = sChild->GetGMPStorage();
   if (!storage) {
     return GMPGenericErr;
   }
   MOZ_ASSERT(storage);
@@ -265,33 +261,34 @@ GMPThreadImpl::Post(GMPTask* aTask)
     bool started = mThread.Start();
     if (!started) {
       NS_WARNING("Unable to start GMPThread!");
       return;
     }
   }
 
   RefPtr<GMPRunnable> r = new GMPRunnable(aTask);
-  mThread.message_loop()->PostTask(NewRunnableMethod(r.get(), &GMPRunnable::Run));
+  mThread.message_loop()->PostTask(
+    NewRunnableMethod(r.get(), &GMPRunnable::Run));
 }
 
 void
 GMPThreadImpl::Join()
 {
   {
     MutexAutoLock lock(mMutex);
     if (mThread.IsRunning()) {
       mThread.Stop();
     }
   }
   delete this;
 }
 
 GMPMutexImpl::GMPMutexImpl()
-: mMonitor("gmp-mutex")
+  : mMonitor("gmp-mutex")
 {
   MOZ_COUNT_CTOR(GMPMutexImpl);
 }
 
 GMPMutexImpl::~GMPMutexImpl()
 {
   MOZ_COUNT_DTOR(GMPMutexImpl);
 }
@@ -319,27 +316,20 @@ NewGMPTask(std::function<void()>&& aFunc
 {
   class Task : public GMPTask
   {
   public:
     explicit Task(std::function<void()>&& aFunction)
       : mFunction(Move(aFunction))
     {
     }
-    void Destroy() override
-    {
-      delete this;
-    }
-    ~Task() override
-    {
-    }
-    void Run() override
-    {
-      mFunction();
-    }
+    void Destroy() override { delete this; }
+    ~Task() override { }
+    void Run() override { mFunction(); }
+
   private:
     std::function<void()> mFunction;
   };
   return new Task(Move(aFunction));
 }
 
 } // namespace gmp
 } // namespace mozilla
--- a/dom/media/gmp/GMPPlatform.h
+++ b/dom/media/gmp/GMPPlatform.h
@@ -13,18 +13,16 @@ namespace mozilla {
 namespace gmp {
 
 class GMPChild;
 
 void InitPlatformAPI(GMPPlatformAPI& aPlatformAPI, GMPChild* aChild);
 
 GMPErr RunOnMainThread(GMPTask* aTask);
 
-GMPTask*
-NewGMPTask(std::function<void()>&& aFunction);
+GMPTask* NewGMPTask(std::function<void()>&& aFunction);
 
-GMPErr
-SetTimerOnMainThread(GMPTask* aTask, int64_t aTimeoutMS);
+GMPErr SetTimerOnMainThread(GMPTask* aTask, int64_t aTimeoutMS);
 
 } // namespace gmp
 } // namespace mozilla
 
 #endif // GMPPlatform_h_
--- a/dom/media/gmp/GMPProcessChild.cpp
+++ b/dom/media/gmp/GMPProcessChild.cpp
@@ -11,38 +11,37 @@
 #include "mozilla/BackgroundHangMonitor.h"
 
 using mozilla::ipc::IOThreadChild;
 
 namespace mozilla {
 namespace gmp {
 
 GMPProcessChild::GMPProcessChild(ProcessId aParentPid)
-: ProcessChild(aParentPid)
+  : ProcessChild(aParentPid)
 {
 }
 
-GMPProcessChild::~GMPProcessChild()
-{
-}
+GMPProcessChild::~GMPProcessChild() { }
 
 bool
 GMPProcessChild::Init(int aArgc, char* aArgv[])
 {
   nsAutoString pluginFilename;
 
 #if defined(OS_POSIX)
   // NB: need to be very careful in ensuring that the first arg
   // (after the binary name) here is indeed the plugin module path.
   // Keep in sync with dom/plugins/PluginModuleParent.
   std::vector<std::string> values = CommandLine::ForCurrentProcess()->argv();
   MOZ_ASSERT(values.size() >= 2, "not enough args");
   pluginFilename = NS_ConvertUTF8toUTF16(nsDependentCString(values[1].c_str()));
 #elif defined(OS_WIN)
-  std::vector<std::wstring> values = CommandLine::ForCurrentProcess()->GetLooseValues();
+  std::vector<std::wstring> values =
+    CommandLine::ForCurrentProcess()->GetLooseValues();
   MOZ_ASSERT(values.size() >= 1, "not enough loose args");
   pluginFilename = nsDependentString(values[0].c_str());
 #else
 #error Not implemented
 #endif
 
   BackgroundHangMonitor::Startup();
 
--- a/dom/media/gmp/GMPProcessChild.h
+++ b/dom/media/gmp/GMPProcessChild.h
@@ -9,17 +9,18 @@
 #include "mozilla/ipc/ProcessChild.h"
 #include "GMPChild.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPLoader;
 
-class GMPProcessChild final : public mozilla::ipc::ProcessChild {
+class GMPProcessChild final : public mozilla::ipc::ProcessChild
+{
 protected:
   typedef mozilla::ipc::ProcessChild ProcessChild;
 
 public:
   explicit GMPProcessChild(ProcessId aParentPid);
   ~GMPProcessChild();
 
   bool Init(int aArgc, char* aArgv[]) override;
--- a/dom/media/gmp/GMPProcessParent.cpp
+++ b/dom/media/gmp/GMPProcessParent.cpp
@@ -1,40 +1,39 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: sw=2 ts=2 et :
  * 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/. */
 
 #include "GMPProcessParent.h"
 #include "GMPUtils.h"
+#include "base/string_util.h"
+#include "base/process_util.h"
 #include "nsIFile.h"
 #include "nsIRunnable.h"
 #if defined(XP_WIN) && defined(MOZ_SANDBOX)
 #include "WinUtils.h"
 #endif
 
-#include "base/string_util.h"
-#include "base/process_util.h"
-
 #include <string>
 
 using std::vector;
 using std::string;
 
 using mozilla::gmp::GMPProcessParent;
 using mozilla::ipc::GeckoChildProcessHost;
 using base::ProcessArchitecture;
 
 namespace mozilla {
 namespace gmp {
 
 GMPProcessParent::GMPProcessParent(const std::string& aGMPPath)
-: GeckoChildProcessHost(GeckoProcessType_GMPlugin),
-  mGMPPath(aGMPPath)
+  : GeckoChildProcessHost(GeckoProcessType_GMPlugin)
+  , mGMPPath(aGMPPath)
 {
   MOZ_COUNT_CTOR(GMPProcessParent);
 }
 
 GMPProcessParent::~GMPProcessParent()
 {
   MOZ_COUNT_DTOR(GMPProcessParent);
 }
@@ -54,19 +53,19 @@ GMPProcessParent::Launch(int32_t aTimeou
   if (!widget::WinUtils::ResolveMovedUsersFolder(wGMPPath)) {
     NS_WARNING("ResolveMovedUsersFolder failed for GMP path.");
     return false;
   }
 
   // If the GMP path is a network path that is not mapped to a drive letter,
   // then we need to fix the path format for the sandbox rule.
   wchar_t volPath[MAX_PATH];
-  if (::GetVolumePathNameW(wGMPPath.c_str(), volPath, MAX_PATH) &&
-      ::GetDriveTypeW(volPath) == DRIVE_REMOTE &&
-      wGMPPath.compare(0, 2, L"\\\\") == 0) {
+  if (::GetVolumePathNameW(wGMPPath.c_str(), volPath, MAX_PATH)
+      && ::GetDriveTypeW(volPath) == DRIVE_REMOTE
+      && wGMPPath.compare(0, 2, L"\\\\") == 0) {
     std::wstring sandboxGMPPath(wGMPPath);
     sandboxGMPPath.insert(1, L"??\\UNC");
     mAllowedFilesRead.push_back(sandboxGMPPath + L"\\*");
   } else {
     mAllowedFilesRead.push_back(wGMPPath + L"\\*");
   }
 
   args.push_back(WideToUTF8(wGMPPath));
@@ -76,17 +75,18 @@ GMPProcessParent::Launch(int32_t aTimeou
 
   return SyncLaunch(args, aTimeoutMs, base::GetCurrentProcessArchitecture());
 }
 
 void
 GMPProcessParent::Delete(nsCOMPtr<nsIRunnable> aCallback)
 {
   mDeletedCallback = aCallback;
-  XRE_GetIOMessageLoop()->PostTask(NewNonOwningRunnableMethod(this, &GMPProcessParent::DoDelete));
+  XRE_GetIOMessageLoop()->PostTask(
+    NewNonOwningRunnableMethod(this, &GMPProcessParent::DoDelete));
 }
 
 void
 GMPProcessParent::DoDelete()
 {
   MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
   Join();
 
--- a/dom/media/gmp/GMPProcessParent.h
+++ b/dom/media/gmp/GMPProcessParent.h
@@ -2,21 +2,21 @@
  * vim: sw=4 ts=4 et :
  * 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 GMPProcessParent_h
 #define GMPProcessParent_h 1
 
-#include "mozilla/Attributes.h"
 #include "base/basictypes.h"
 #include "base/file_path.h"
 #include "base/thread.h"
 #include "chrome/common/child_process_host.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/ipc/GeckoChildProcessHost.h"
 
 class nsIRunnable;
 
 namespace mozilla {
 namespace gmp {
 
 class GMPProcessParent final : public mozilla::ipc::GeckoChildProcessHost
--- a/dom/media/gmp/GMPService.cpp
+++ b/dom/media/gmp/GMPService.cpp
@@ -1,50 +1,49 @@
 /* -*- 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/. */
 
 #include "GMPService.h"
-#include "GMPServiceParent.h"
+#include "GMPContentParent.h"
+#include "GMPCrashHelper.h"
+#include "GMPDecryptorParent.h"
+#include "GMPParent.h"
 #include "GMPServiceChild.h"
-#include "GMPContentParent.h"
-#include "prio.h"
-#include "mozilla/Logging.h"
-#include "GMPParent.h"
+#include "GMPServiceParent.h"
 #include "GMPVideoDecoderParent.h"
-#include "nsIObserverService.h"
 #include "GeckoChildProcessHost.h"
+#include "VideoUtils.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/ClearOnShutdown.h"
-#include "mozilla/SyncRunnable.h"
-#include "nsXPCOMPrivate.h"
-#include "mozilla/Services.h"
-#include "nsNativeCharsetUtils.h"
-#include "nsIXULAppInfo.h"
-#include "nsIConsoleService.h"
-#include "mozilla/Unused.h"
-#include "GMPDecryptorParent.h"
-#include "nsComponentManagerUtils.h"
-#include "runnable_utils.h"
-#include "VideoUtils.h"
+#include "mozilla/EventDispatcher.h"
+#include "mozilla/Logging.h"
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
 #include "mozilla/SandboxInfo.h"
 #endif
+#include "mozilla/Services.h"
+#include "mozilla/SyncRunnable.h"
+#include "mozilla/Unused.h"
+#include "mozilla/dom/PluginCrashedEvent.h"
 #include "nsAppDirectoryServiceDefs.h"
-#include "nsDirectoryServiceUtils.h"
+#include "nsComponentManagerUtils.h"
 #include "nsDirectoryServiceDefs.h"
+#include "nsDirectoryServiceUtils.h"
 #include "nsHashKeys.h"
+#include "nsIConsoleService.h"
 #include "nsIFile.h"
+#include "nsIObserverService.h"
 #include "nsISimpleEnumerator.h"
+#include "nsIXULAppInfo.h"
+#include "nsNativeCharsetUtils.h"
 #include "nsThreadUtils.h"
-#include "GMPCrashHelper.h"
-
-#include "mozilla/dom/PluginCrashedEvent.h"
-#include "mozilla/EventDispatcher.h"
-#include "mozilla/Attributes.h"
+#include "nsXPCOMPrivate.h"
+#include "prio.h"
+#include "runnable_utils.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
 LogModule*
@@ -77,38 +76,33 @@ public:
     RefPtr<GeckoMediaPluginService> service;
 
     if (NS_IsMainThread()) {
       service = GetOrCreateOnMainThread();
     } else {
       nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
       MOZ_ASSERT(mainThread);
 
-      RefPtr<GMPServiceCreateHelper> createHelper = new GMPServiceCreateHelper();
+      RefPtr<GMPServiceCreateHelper> createHelper =
+        new GMPServiceCreateHelper();
 
       mozilla::SyncRunnable::DispatchToThread(mainThread, createHelper, true);
 
       service = createHelper->mService.forget();
     }
 
     return service.forget();
   }
 
 private:
-  GMPServiceCreateHelper()
-  {
-  }
+  GMPServiceCreateHelper() { }
 
-  ~GMPServiceCreateHelper()
-  {
-    MOZ_ASSERT(!mService);
-  }
+  ~GMPServiceCreateHelper() { MOZ_ASSERT(!mService); }
 
-  static already_AddRefed<GeckoMediaPluginService>
-  GetOrCreateOnMainThread()
+  static already_AddRefed<GeckoMediaPluginService> GetOrCreateOnMainThread()
   {
     MOZ_ASSERT(NS_IsMainThread());
 
     if (!sSingletonService) {
       if (XRE_IsParentProcess()) {
         RefPtr<GeckoMediaPluginServiceParent> service =
           new GeckoMediaPluginServiceParent();
         service->Init();
@@ -138,55 +132,58 @@ private:
 };
 
 already_AddRefed<GeckoMediaPluginService>
 GeckoMediaPluginService::GetGeckoMediaPluginService()
 {
   return GMPServiceCreateHelper::GetOrCreate();
 }
 
-NS_IMPL_ISUPPORTS(GeckoMediaPluginService, mozIGeckoMediaPluginService, nsIObserver)
+NS_IMPL_ISUPPORTS(GeckoMediaPluginService,
+                  mozIGeckoMediaPluginService,
+                  nsIObserver)
 
 GeckoMediaPluginService::GeckoMediaPluginService()
   : mMutex("GeckoMediaPluginService::mMutex")
   , mGMPThreadShutdown(false)
   , mShuttingDownOnGMPThread(false)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
   if (appInfo) {
     nsAutoCString version;
     nsAutoCString buildID;
-    if (NS_SUCCEEDED(appInfo->GetVersion(version)) &&
-        NS_SUCCEEDED(appInfo->GetAppBuildID(buildID))) {
+    if (NS_SUCCEEDED(appInfo->GetVersion(version))
+        && NS_SUCCEEDED(appInfo->GetAppBuildID(buildID))) {
       LOGD(("GeckoMediaPluginService created; Gecko version=%s buildID=%s",
             version.get(), buildID.get()));
     }
   }
 }
 
-GeckoMediaPluginService::~GeckoMediaPluginService()
-{
-}
+GeckoMediaPluginService::~GeckoMediaPluginService() { }
 
 NS_IMETHODIMP
 GeckoMediaPluginService::RunPluginCrashCallbacks(uint32_t aPluginId,
                                                  const nsACString& aPluginName)
 {
   MOZ_ASSERT(NS_IsMainThread());
   LOGD(("%s::%s(%i)", __CLASS__, __FUNCTION__, aPluginId));
 
   nsAutoPtr<nsTArray<RefPtr<GMPCrashHelper>>> helpers;
   {
     MutexAutoLock lock(mMutex);
     mPluginCrashHelpers.RemoveAndForget(aPluginId, helpers);
   }
   if (!helpers) {
-    LOGD(("%s::%s(%i) No crash helpers, not handling crash.", __CLASS__, __FUNCTION__, aPluginId));
+    LOGD(("%s::%s(%i) No crash helpers, not handling crash.",
+          __CLASS__,
+          __FUNCTION__,
+          aPluginId));
     return NS_OK;
   }
 
   for (const auto& helper : *helpers) {
     nsCOMPtr<nsPIDOMWindowInner> window = helper->GetPluginCrashedEventTarget();
     if (NS_WARN_IF(!window)) {
       continue;
     }
@@ -215,19 +212,21 @@ GeckoMediaPluginService::RunPluginCrashC
   return NS_OK;
 }
 
 nsresult
 GeckoMediaPluginService::Init()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
+  nsCOMPtr<nsIObserverService> obsService =
+    mozilla::services::GetObserverService();
   MOZ_ASSERT(obsService);
-  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID, false));
+  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(
+    this, NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID, false));
 
   // Kick off scanning for plugins
   nsCOMPtr<nsIThread> thread;
   return GetThread(getter_AddRefs(thread));
 }
 
 void
 GeckoMediaPluginService::ShutdownGMPThread()
@@ -282,17 +281,18 @@ GeckoMediaPluginService::GetThread(nsITh
       return NS_ERROR_FAILURE;
     }
 
     nsresult rv = NS_NewNamedThread("GMPThread", getter_AddRefs(mGMPThread));
     if (NS_FAILED(rv)) {
       return rv;
     }
 
-    mAbstractGMPThread = AbstractThread::CreateXPCOMThreadWrapper(mGMPThread, false);
+    mAbstractGMPThread =
+      AbstractThread::CreateXPCOMThreadWrapper(mGMPThread, false);
 
     // Tell the thread to initialize plugins
     InitializePlugins(mAbstractGMPThread.get());
   }
 
   nsCOMPtr<nsIThread> copy = mGMPThread;
   copy.forget(aThread);
 
@@ -302,73 +302,82 @@ GeckoMediaPluginService::GetThread(nsITh
 RefPtr<AbstractThread>
 GeckoMediaPluginService::GetAbstractGMPThread()
 {
   MutexAutoLock lock(mMutex);
   return mAbstractGMPThread;
 }
 
 NS_IMETHODIMP
-GeckoMediaPluginService::GetDecryptingGMPVideoDecoder(GMPCrashHelper* aHelper,
-                                                      nsTArray<nsCString>* aTags,
-                                                      const nsACString& aNodeId,
-                                                      UniquePtr<GetGMPVideoDecoderCallback>&& aCallback,
-                                                      uint32_t aDecryptorId)
+GeckoMediaPluginService::GetDecryptingGMPVideoDecoder(
+  GMPCrashHelper* aHelper,
+  nsTArray<nsCString>* aTags,
+  const nsACString& aNodeId,
+  UniquePtr<GetGMPVideoDecoderCallback>&& aCallback,
+  uint32_t aDecryptorId)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
   NS_ENSURE_ARG(aTags && aTags->Length() > 0);
   NS_ENSURE_ARG(aCallback);
 
   if (mShuttingDownOnGMPThread) {
     return NS_ERROR_FAILURE;
   }
 
   GetGMPVideoDecoderCallback* rawCallback = aCallback.release();
   RefPtr<AbstractThread> thread(GetAbstractGMPThread());
   RefPtr<GMPCrashHelper> helper(aHelper);
-  GetContentParent(aHelper, aNodeId, NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER), *aTags)
-    ->Then(thread, __func__,
-      [rawCallback, helper, aDecryptorId](RefPtr<GMPContentParent::CloseBlocker> wrapper) {
-        RefPtr<GMPContentParent> parent = wrapper->mParent;
-        UniquePtr<GetGMPVideoDecoderCallback> callback(rawCallback);
-        GMPVideoDecoderParent* actor = nullptr;
-        GMPVideoHostImpl* host = nullptr;
-        if (parent && NS_SUCCEEDED(parent->GetGMPVideoDecoder(&actor, aDecryptorId))) {
-          host = &(actor->Host());
-          actor->SetCrashHelper(helper);
-        }
-        callback->Done(actor, host);
-      },
-      [rawCallback] {
-        UniquePtr<GetGMPVideoDecoderCallback> callback(rawCallback);
-        callback->Done(nullptr, nullptr);
-      });
+  GetContentParent(
+    aHelper, aNodeId, NS_LITERAL_CSTRING(GMP_API_VIDEO_DECODER), *aTags)
+    ->Then(thread,
+           __func__,
+           [rawCallback, helper, aDecryptorId](
+             RefPtr<GMPContentParent::CloseBlocker> wrapper) {
+             RefPtr<GMPContentParent> parent = wrapper->mParent;
+             UniquePtr<GetGMPVideoDecoderCallback> callback(rawCallback);
+             GMPVideoDecoderParent* actor = nullptr;
+             GMPVideoHostImpl* host = nullptr;
+             if (parent && NS_SUCCEEDED(parent->GetGMPVideoDecoder(
+                             &actor, aDecryptorId))) {
+               host = &(actor->Host());
+               actor->SetCrashHelper(helper);
+             }
+             callback->Done(actor, host);
+           },
+           [rawCallback] {
+             UniquePtr<GetGMPVideoDecoderCallback> callback(rawCallback);
+             callback->Done(nullptr, nullptr);
+           });
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-GeckoMediaPluginService::GetGMPVideoEncoder(GMPCrashHelper* aHelper,
-                                            nsTArray<nsCString>* aTags,
-                                            const nsACString& aNodeId,
-                                            UniquePtr<GetGMPVideoEncoderCallback>&& aCallback)
+GeckoMediaPluginService::GetGMPVideoEncoder(
+  GMPCrashHelper* aHelper,
+  nsTArray<nsCString>* aTags,
+  const nsACString& aNodeId,
+  UniquePtr<GetGMPVideoEncoderCallback>&& aCallback)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
   NS_ENSURE_ARG(aTags && aTags->Length() > 0);
   NS_ENSURE_ARG(aCallback);
 
   if (mShuttingDownOnGMPThread) {
     return NS_ERROR_FAILURE;
   }
 
   GetGMPVideoEncoderCallback* rawCallback = aCallback.release();
   RefPtr<AbstractThread> thread(GetAbstractGMPThread());
   RefPtr<GMPCrashHelper> helper(aHelper);
-  GetContentParent(aHelper, aNodeId, NS_LITERAL_CSTRING(GMP_API_VIDEO_ENCODER), *aTags)
-    ->Then(thread, __func__,
+  GetContentParent(
+    aHelper, aNodeId, NS_LITERAL_CSTRING(GMP_API_VIDEO_ENCODER), *aTags)
+    ->Then(
+      thread,
+      __func__,
       [rawCallback, helper](RefPtr<GMPContentParent::CloseBlocker> wrapper) {
         RefPtr<GMPContentParent> parent = wrapper->mParent;
         UniquePtr<GetGMPVideoEncoderCallback> callback(rawCallback);
         GMPVideoEncoderParent* actor = nullptr;
         GMPVideoHostImpl* host = nullptr;
         if (parent && NS_SUCCEEDED(parent->GetGMPVideoEncoder(&actor))) {
           host = &(actor->Host());
           actor->SetCrashHelper(helper);
@@ -379,20 +388,21 @@ GeckoMediaPluginService::GetGMPVideoEnco
         UniquePtr<GetGMPVideoEncoderCallback> callback(rawCallback);
         callback->Done(nullptr, nullptr);
       });
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-GeckoMediaPluginService::GetGMPDecryptor(GMPCrashHelper* aHelper,
-                                         nsTArray<nsCString>* aTags,
-                                         const nsACString& aNodeId,
-                                         UniquePtr<GetGMPDecryptorCallback>&& aCallback)
+GeckoMediaPluginService::GetGMPDecryptor(
+  GMPCrashHelper* aHelper,
+  nsTArray<nsCString>* aTags,
+  const nsACString& aNodeId,
+  UniquePtr<GetGMPDecryptorCallback>&& aCallback)
 {
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
   if (!SandboxInfo::Get().CanSandboxMedia()) {
     NS_WARNING("GeckoMediaPluginService::GetGMPDecryptor: "
                "EME decryption not available without sandboxing support.");
     return NS_ERROR_NOT_AVAILABLE;
   }
 #endif
@@ -403,18 +413,21 @@ GeckoMediaPluginService::GetGMPDecryptor
 
   if (mShuttingDownOnGMPThread) {
     return NS_ERROR_FAILURE;
   }
 
   GetGMPDecryptorCallback* rawCallback = aCallback.release();
   RefPtr<AbstractThread> thread(GetAbstractGMPThread());
   RefPtr<GMPCrashHelper> helper(aHelper);
-  GetContentParent(aHelper, aNodeId, NS_LITERAL_CSTRING(GMP_API_DECRYPTOR), *aTags)
-    ->Then(thread, __func__,
+  GetContentParent(
+    aHelper, aNodeId, NS_LITERAL_CSTRING(GMP_API_DECRYPTOR), *aTags)
+    ->Then(
+      thread,
+      __func__,
       [rawCallback, helper](RefPtr<GMPContentParent::CloseBlocker> wrapper) {
         RefPtr<GMPContentParent> parent = wrapper->mParent;
         UniquePtr<GetGMPDecryptorCallback> callback(rawCallback);
         GMPDecryptorParent* actor = nullptr;
         if (parent && NS_SUCCEEDED(parent->GetGMPDecryptor(&actor))) {
           actor->SetCrashHelper(helper);
         }
         callback->Done(actor);
@@ -423,33 +436,35 @@ GeckoMediaPluginService::GetGMPDecryptor
         UniquePtr<GetGMPDecryptorCallback> callback(rawCallback);
         callback->Done(nullptr);
       });
 
   return NS_OK;
 }
 
 void
-GeckoMediaPluginService::ConnectCrashHelper(uint32_t aPluginId, GMPCrashHelper* aHelper)
+GeckoMediaPluginService::ConnectCrashHelper(uint32_t aPluginId,
+                                            GMPCrashHelper* aHelper)
 {
   if (!aHelper) {
     return;
   }
   MutexAutoLock lock(mMutex);
   nsTArray<RefPtr<GMPCrashHelper>>* helpers;
   if (!mPluginCrashHelpers.Get(aPluginId, &helpers)) {
     helpers = new nsTArray<RefPtr<GMPCrashHelper>>();
     mPluginCrashHelpers.Put(aPluginId, helpers);
   } else if (helpers->Contains(aHelper)) {
     return;
   }
   helpers->AppendElement(aHelper);
 }
 
-void GeckoMediaPluginService::DisconnectCrashHelper(GMPCrashHelper* aHelper)
+void
+GeckoMediaPluginService::DisconnectCrashHelper(GMPCrashHelper* aHelper)
 {
   if (!aHelper) {
     return;
   }
   MutexAutoLock lock(mMutex);
   for (auto iter = mPluginCrashHelpers.Iter(); !iter.Done(); iter.Next()) {
     nsTArray<RefPtr<GMPCrashHelper>>* helpers = iter.Data();
     if (!helpers->Contains(aHelper)) {
--- a/dom/media/gmp/GMPService.h
+++ b/dom/media/gmp/GMPService.h
@@ -1,33 +1,32 @@
 /* -*- 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 GMPService_h_
 #define GMPService_h_
 
-#include "nsString.h"
+#include "GMPContentParent.h"
 #include "mozIGeckoMediaPluginService.h"
-#include "nsIObserver.h"
-#include "nsTArray.h"
+#include "mozilla/AbstractThread.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Monitor.h"
-#include "nsString.h"
+#include "mozilla/MozPromise.h"
 #include "nsCOMPtr.h"
+#include "nsClassHashtable.h"
+#include "nsIDocument.h"
+#include "nsIObserver.h"
+#include "nsISupportsImpl.h"
 #include "nsIThread.h"
-#include "nsThreadUtils.h"
-#include "nsIDocument.h"
 #include "nsIWeakReference.h"
-#include "mozilla/AbstractThread.h"
-#include "nsClassHashtable.h"
-#include "nsISupportsImpl.h"
-#include "mozilla/MozPromise.h"
-#include "GMPContentParent.h"
+#include "nsString.h"
+#include "nsTArray.h"
+#include "nsThreadUtils.h"
 
 template <class> struct already_AddRefed;
 
 namespace mozilla {
 
 class GMPCrashHelper;
 
 extern LogModule* GetGMPLog();
@@ -43,41 +42,42 @@ public:
   static already_AddRefed<GeckoMediaPluginService> GetGeckoMediaPluginService();
 
   virtual nsresult Init();
 
   NS_DECL_THREADSAFE_ISUPPORTS
 
   // mozIGeckoMediaPluginService
   NS_IMETHOD GetThread(nsIThread** aThread) override;
-  NS_IMETHOD GetDecryptingGMPVideoDecoder(GMPCrashHelper* aHelper,
-                                          nsTArray<nsCString>* aTags,
-                                          const nsACString& aNodeId,
-                                          UniquePtr<GetGMPVideoDecoderCallback>&& aCallback,
-                                          uint32_t aDecryptorId)
-    override;
-  NS_IMETHOD GetGMPVideoEncoder(GMPCrashHelper* aHelper,
-                                nsTArray<nsCString>* aTags,
-                                const nsACString& aNodeId,
-                                UniquePtr<GetGMPVideoEncoderCallback>&& aCallback)
-    override;
-  NS_IMETHOD GetGMPDecryptor(GMPCrashHelper* aHelper,
-                             nsTArray<nsCString>* aTags,
-                             const nsACString& aNodeId,
-                             UniquePtr<GetGMPDecryptorCallback>&& aCallback)
-    override;
+  NS_IMETHOD GetDecryptingGMPVideoDecoder(
+    GMPCrashHelper* aHelper,
+    nsTArray<nsCString>* aTags,
+    const nsACString& aNodeId,
+    UniquePtr<GetGMPVideoDecoderCallback>&& aCallback,
+    uint32_t aDecryptorId) override;
+  NS_IMETHOD GetGMPVideoEncoder(
+    GMPCrashHelper* aHelper,
+    nsTArray<nsCString>* aTags,
+    const nsACString& aNodeId,
+    UniquePtr<GetGMPVideoEncoderCallback>&& aCallback) override;
+  NS_IMETHOD GetGMPDecryptor(
+    GMPCrashHelper* aHelper,
+    nsTArray<nsCString>* aTags,
+    const nsACString& aNodeId,
+    UniquePtr<GetGMPDecryptorCallback>&& aCallback) override;
 
   // Helper for backwards compatibility with WebRTC/tests.
   NS_IMETHOD
   GetGMPVideoDecoder(GMPCrashHelper* aHelper,
                      nsTArray<nsCString>* aTags,
                      const nsACString& aNodeId,
                      UniquePtr<GetGMPVideoDecoderCallback>&& aCallback) override
   {
-    return GetDecryptingGMPVideoDecoder(aHelper, aTags, aNodeId, Move(aCallback), 0);
+    return GetDecryptingGMPVideoDecoder(
+      aHelper, aTags, aNodeId, Move(aCallback), 0);
   }
 
   NS_IMETHOD RunPluginCrashCallbacks(uint32_t aPluginId,
                                      const nsACString& aPluginName) override;
 
   RefPtr<AbstractThread> GetAbstractGMPThread();
 
   void ConnectCrashHelper(uint32_t aPluginId, GMPCrashHelper* aHelper);
@@ -91,25 +91,27 @@ protected:
 
   virtual RefPtr<GetGMPContentParentPromise>
   GetContentParent(GMPCrashHelper* aHelper,
                    const nsACString& aNodeId,
                    const nsCString& aAPI,
                    const nsTArray<nsCString>& aTags) = 0;
 
   nsresult GMPDispatch(nsIRunnable* event, uint32_t flags = NS_DISPATCH_NORMAL);
-  nsresult GMPDispatch(already_AddRefed<nsIRunnable> event, uint32_t flags = NS_DISPATCH_NORMAL);
+  nsresult GMPDispatch(already_AddRefed<nsIRunnable> event,
+                       uint32_t flags = NS_DISPATCH_NORMAL);
   void ShutdownGMPThread();
 
   Mutex mMutex; // Protects mGMPThread, mAbstractGMPThread, mPluginCrashHelpers,
                 // mGMPThreadShutdown and some members in derived classes.
   nsCOMPtr<nsIThread> mGMPThread;
   RefPtr<AbstractThread> mAbstractGMPThread;
   bool mGMPThreadShutdown;
   bool mShuttingDownOnGMPThread;
 
-  nsClassHashtable<nsUint32HashKey, nsTArray<RefPtr<GMPCrashHelper>>> mPluginCrashHelpers;
+  nsClassHashtable<nsUint32HashKey, nsTArray<RefPtr<GMPCrashHelper>>>
+    mPluginCrashHelpers;
 };
 
 } // namespace gmp
 } // namespace mozilla
 
 #endif // GMPService_h_
--- a/dom/media/gmp/GMPServiceChild.cpp
+++ b/dom/media/gmp/GMPServiceChild.cpp
@@ -1,29 +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/. */
 
 #include "GMPServiceChild.h"
-#include "mozilla/dom/ContentChild.h"
-#include "mozilla/ClearOnShutdown.h"
-#include "mozilla/StaticPtr.h"
-#include "mozIGeckoMediaPluginService.h"
-#include "mozIGeckoMediaPluginChromeService.h"
-#include "nsCOMPtr.h"
+#include "GMPContentParent.h"
 #include "GMPParent.h"
-#include "GMPContentParent.h"
-#include "nsXPCOMPrivate.h"
-#include "mozilla/SyncRunnable.h"
+#include "base/task.h"
+#include "mozIGeckoMediaPluginChromeService.h"
+#include "mozIGeckoMediaPluginService.h"
+#include "mozilla/ClearOnShutdown.h"
 #include "mozilla/StaticMutex.h"
+#include "mozilla/StaticPtr.h"
+#include "mozilla/SyncRunnable.h"
+#include "mozilla/dom/ContentChild.h"
+#include "nsCOMPtr.h"
+#include "nsComponentManagerUtils.h"
+#include "nsIObserverService.h"
+#include "nsXPCOMPrivate.h"
 #include "runnable_utils.h"
-#include "base/task.h"
-#include "nsIObserverService.h"
-#include "nsComponentManagerUtils.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
@@ -55,26 +55,29 @@ GeckoMediaPluginServiceChild::GetSinglet
 RefPtr<GetGMPContentParentPromise>
 GeckoMediaPluginServiceChild::GetContentParent(GMPCrashHelper* aHelper,
                                                const nsACString& aNodeId,
                                                const nsCString& aAPI,
                                                const nsTArray<nsCString>& aTags)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
 
-  MozPromiseHolder<GetGMPContentParentPromise>* rawHolder = new MozPromiseHolder<GetGMPContentParentPromise>();
+  MozPromiseHolder<GetGMPContentParentPromise>* rawHolder =
+    new MozPromiseHolder<GetGMPContentParentPromise>();
   RefPtr<GetGMPContentParentPromise> promise = rawHolder->Ensure(__func__);
   RefPtr<AbstractThread> thread(GetAbstractGMPThread());
 
   nsCString nodeId(aNodeId);
   nsCString api(aAPI);
   nsTArray<nsCString> tags(aTags);
   RefPtr<GMPCrashHelper> helper(aHelper);
   RefPtr<GeckoMediaPluginServiceChild> self(this);
-  GetServiceChild()->Then(thread, __func__,
+  GetServiceChild()->Then(
+    thread,
+    __func__,
     [self, nodeId, api, tags, helper, rawHolder](GMPServiceChild* child) {
       UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>> holder(rawHolder);
       nsresult rv;
 
       nsTArray<base::ProcessId> alreadyBridgedTo;
       child->GetAlreadyBridgedTo(alreadyBridgedTo);
 
       base::ProcessId otherProcess;
@@ -97,29 +100,32 @@ GeckoMediaPluginServiceChild::GetContent
         // helper so that if the launch failed due to the plugin crashing,
         // we can report the crash via the crash reporter. The crash
         // handling notification will arrive shortly if the launch failed
         // due to the plugin crashing.
         self->ConnectCrashHelper(pluginId, helper);
       }
 
       if (!ok || NS_FAILED(rv)) {
-        LOGD(("GeckoMediaPluginServiceChild::GetContentParent SendLaunchGMP failed rv=%d", rv));
+        LOGD(("GeckoMediaPluginServiceChild::GetContentParent SendLaunchGMP "
+              "failed rv=%d",
+              rv));
         holder->Reject(rv, __func__);
         return;
       }
 
-      RefPtr<GMPContentParent> parent = child->GetBridgedGMPContentParent(otherProcess,
-                                                                          Move(endpoint));
+      RefPtr<GMPContentParent> parent =
+        child->GetBridgedGMPContentParent(otherProcess, Move(endpoint));
       if (!alreadyBridgedTo.Contains(otherProcess)) {
         parent->SetDisplayName(displayName);
         parent->SetPluginId(pluginId);
       }
 
-      RefPtr<GMPContentParent::CloseBlocker> blocker(new GMPContentParent::CloseBlocker(parent));
+      RefPtr<GMPContentParent::CloseBlocker> blocker(
+        new GMPContentParent::CloseBlocker(parent));
       holder->Resolve(blocker, __func__);
     },
     [rawHolder](nsresult rv) {
       UniquePtr<MozPromiseHolder<GetGMPContentParentPromise>> holder(rawHolder);
       holder->Reject(rv, __func__);
     });
 
   return promise;
@@ -185,17 +191,18 @@ GMPCapabilitiesToString()
     }
     s.Append(gmp.ToString());
   }
   return s;
 }
 
 /* static */
 void
-GeckoMediaPluginServiceChild::UpdateGMPCapabilities(nsTArray<GMPCapabilityData>&& aCapabilities)
+GeckoMediaPluginServiceChild::UpdateGMPCapabilities(
+  nsTArray<GMPCapabilityData>&& aCapabilities)
 {
   {
     // The mutex should unlock before sending the "gmp-changed" observer service notification.
     StaticMutexAutoLock lock(sGMPCapabilitiesMutex);
     if (!sGMPCapabilities) {
       sGMPCapabilities = new nsTArray<GMPCapabilityAndVersion>();
       ClearOnShutdown(&sGMPCapabilities);
     }
@@ -235,34 +242,36 @@ GeckoMediaPluginServiceChild::HasPluginF
     }
   }
 
   *aHasPlugin = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-GeckoMediaPluginServiceChild::GetNodeId(const nsAString& aOrigin,
-                                        const nsAString& aTopLevelOrigin,
-                                        const nsAString& aGMPName,
-                                        UniquePtr<GetNodeIdCallback>&& aCallback)
+GeckoMediaPluginServiceChild::GetNodeId(
+  const nsAString& aOrigin,
+  const nsAString& aTopLevelOrigin,
+  const nsAString& aGMPName,
+  UniquePtr<GetNodeIdCallback>&& aCallback)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
 
   GetNodeIdCallback* rawCallback = aCallback.release();
   RefPtr<AbstractThread> thread(GetAbstractGMPThread());
   nsString origin(aOrigin);
   nsString topLevelOrigin(aTopLevelOrigin);
   nsString gmpName(aGMPName);
-  GetServiceChild()->Then(thread, __func__,
+  GetServiceChild()->Then(
+    thread,
+    __func__,
     [rawCallback, origin, topLevelOrigin, gmpName](GMPServiceChild* child) {
       UniquePtr<GetNodeIdCallback> callback(rawCallback);
       nsCString outId;
-      if (!child->SendGetGMPNodeId(origin, topLevelOrigin,
-                                   gmpName, &outId)) {
+      if (!child->SendGetGMPNodeId(origin, topLevelOrigin, gmpName, &outId)) {
         callback->Done(NS_ERROR_FAILURE, EmptyCString());
         return;
       }
 
       callback->Done(NS_OK, outId);
     },
     [rawCallback](nsresult rv) {
       UniquePtr<GetNodeIdCallback> callback(rawCallback);
@@ -275,83 +284,85 @@ GeckoMediaPluginServiceChild::GetNodeId(
 NS_IMETHODIMP
 GeckoMediaPluginServiceChild::Observe(nsISupports* aSubject,
                                       const char* aTopic,
                                       const char16_t* aSomeData)
 {
   LOGD(("%s::%s: %s", __CLASS__, __FUNCTION__, aTopic));
   if (!strcmp(NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID, aTopic)) {
     if (mServiceChild) {
-      mozilla::SyncRunnable::DispatchToThread(mGMPThread,
-                                              WrapRunnable(mServiceChild.get(),
-                                                           &PGMPServiceChild::Close));
+      mozilla::SyncRunnable::DispatchToThread(
+        mGMPThread,
+        WrapRunnable(mServiceChild.get(), &PGMPServiceChild::Close));
       mServiceChild = nullptr;
     }
     ShutdownGMPThread();
   }
 
   return NS_OK;
 }
 
 RefPtr<GeckoMediaPluginServiceChild::GetServiceChildPromise>
 GeckoMediaPluginServiceChild::GetServiceChild()
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
 
   if (!mServiceChild) {
     dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
     if (!contentChild) {
-      return GetServiceChildPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
+      return GetServiceChildPromise::CreateAndReject(NS_ERROR_FAILURE,
+                                                     __func__);
     }
-    MozPromiseHolder<GetServiceChildPromise>* holder = mGetServiceChildPromises.AppendElement();
+    MozPromiseHolder<GetServiceChildPromise>* holder =
+      mGetServiceChildPromises.AppendElement();
     RefPtr<GetServiceChildPromise> promise = holder->Ensure(__func__);
     if (mGetServiceChildPromises.Length() == 1) {
-        NS_DispatchToMainThread(WrapRunnable(contentChild,
-                                             &dom::ContentChild::SendCreateGMPService));
+      NS_DispatchToMainThread(
+        WrapRunnable(contentChild, &dom::ContentChild::SendCreateGMPService));
     }
     return promise;
   }
-  return GetServiceChildPromise::CreateAndResolve(mServiceChild.get(), __func__);
+  return GetServiceChildPromise::CreateAndResolve(mServiceChild.get(),
+                                                  __func__);
 }
 
 void
-GeckoMediaPluginServiceChild::SetServiceChild(UniquePtr<GMPServiceChild>&& aServiceChild)
+GeckoMediaPluginServiceChild::SetServiceChild(
+  UniquePtr<GMPServiceChild>&& aServiceChild)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
 
   mServiceChild = Move(aServiceChild);
 
   nsTArray<MozPromiseHolder<GetServiceChildPromise>> holders;
   holders.SwapElements(mGetServiceChildPromises);
   for (MozPromiseHolder<GetServiceChildPromise>& holder : holders) {
     holder.Resolve(mServiceChild.get(), __func__);
   }
 }
 
 void
-GeckoMediaPluginServiceChild::RemoveGMPContentParent(GMPContentParent* aGMPContentParent)
+GeckoMediaPluginServiceChild::RemoveGMPContentParent(
+  GMPContentParent* aGMPContentParent)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
 
   if (mServiceChild) {
     mServiceChild->RemoveGMPContentParent(aGMPContentParent);
   }
 }
 
-GMPServiceChild::GMPServiceChild()
-{
-}
+GMPServiceChild::GMPServiceChild() { }
 
-GMPServiceChild::~GMPServiceChild()
-{
-}
+GMPServiceChild::~GMPServiceChild() { }
 
 already_AddRefed<GMPContentParent>
-GMPServiceChild::GetBridgedGMPContentParent(ProcessId aOtherPid,
-                                            ipc::Endpoint<PGMPContentParent>&& endpoint)
+GMPServiceChild::GetBridgedGMPContentParent(
+  ProcessId aOtherPid,
+  ipc::Endpoint<PGMPContentParent>&& endpoint)
 {
   RefPtr<GMPContentParent> parent;
   mContentParents.Get(aOtherPid, getter_AddRefs(parent));
 
   if (parent) {
     return parent.forget();
   }
 
@@ -378,32 +389,33 @@ GMPServiceChild::RemoveGMPContentParent(
     if (parent == aGMPContentParent) {
       iter.Remove();
       break;
     }
   }
 }
 
 void
-GMPServiceChild::GetAlreadyBridgedTo(nsTArray<base::ProcessId>& aAlreadyBridgedTo)
+GMPServiceChild::GetAlreadyBridgedTo(
+  nsTArray<base::ProcessId>& aAlreadyBridgedTo)
 {
   aAlreadyBridgedTo.SetCapacity(mContentParents.Count());
   for (auto iter = mContentParents.Iter(); !iter.Done(); iter.Next()) {
     const uint64_t& id = iter.Key();
     aAlreadyBridgedTo.AppendElement(id);
   }
 }
 
 class OpenPGMPServiceChild : public mozilla::Runnable
 {
 public:
   OpenPGMPServiceChild(UniquePtr<GMPServiceChild>&& aGMPServiceChild,
                        ipc::Endpoint<PGMPServiceChild>&& aEndpoint)
-    : mGMPServiceChild(Move(aGMPServiceChild)),
-      mEndpoint(Move(aEndpoint))
+    : mGMPServiceChild(Move(aGMPServiceChild))
+    , mEndpoint(Move(aEndpoint))
   {
   }
 
   NS_IMETHOD Run() override
   {
     RefPtr<GeckoMediaPluginServiceChild> gmp =
       GeckoMediaPluginServiceChild::GetSingleton();
     MOZ_ASSERT(!gmp->mServiceChild);
--- a/dom/media/gmp/GMPServiceChild.h
+++ b/dom/media/gmp/GMPServiceChild.h
@@ -35,48 +35,51 @@ public:
                        UniquePtr<GetNodeIdCallback>&& aCallback) override;
 
   NS_DECL_NSIOBSERVER
 
   void SetServiceChild(UniquePtr<GMPServiceChild>&& aServiceChild);
 
   void RemoveGMPContentParent(GMPContentParent* aGMPContentParent);
 
-  static void UpdateGMPCapabilities(nsTArray<mozilla::dom::GMPCapabilityData>&& aCapabilities);
+  static void UpdateGMPCapabilities(
+    nsTArray<mozilla::dom::GMPCapabilityData>&& aCapabilities);
 
 protected:
   void InitializePlugins(AbstractThread*) override
   {
     // Nothing to do here.
   }
 
   virtual RefPtr<GetGMPContentParentPromise>
   GetContentParent(GMPCrashHelper* aHelper,
                    const nsACString& aNodeId,
                    const nsCString& aAPI,
                    const nsTArray<nsCString>& aTags) override;
 
 private:
   friend class OpenPGMPServiceChild;
 
-  typedef MozPromise<GMPServiceChild*, nsresult, /* IsExclusive = */ true> GetServiceChildPromise;
+  typedef MozPromise<GMPServiceChild*, nsresult, /* IsExclusive = */ true>
+    GetServiceChildPromise;
   RefPtr<GetServiceChildPromise> GetServiceChild();
 
   nsTArray<MozPromiseHolder<GetServiceChildPromise>> mGetServiceChildPromises;
   UniquePtr<GMPServiceChild> mServiceChild;
 };
 
 class GMPServiceChild : public PGMPServiceChild
 {
 public:
-  explicit GMPServiceChild();
+  GMPServiceChild();
   virtual ~GMPServiceChild();
 
-  already_AddRefed<GMPContentParent> GetBridgedGMPContentParent(ProcessId aOtherPid,
-                                                                ipc::Endpoint<PGMPContentParent>&& endpoint);
+  already_AddRefed<GMPContentParent> GetBridgedGMPContentParent(
+    ProcessId aOtherPid,
+    ipc::Endpoint<PGMPContentParent>&& endpoint);
 
   void RemoveGMPContentParent(GMPContentParent* aGMPContentParent);
 
   void GetAlreadyBridgedTo(nsTArray<ProcessId>& aAlreadyBridgedTo);
 
   static bool Create(Endpoint<PGMPServiceChild>&& aGMPService);
 
 private:
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -1,54 +1,54 @@
 /* -*- 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/. */
 
 #include "GMPServiceParent.h"
+#include "GMPDecoderModule.h"
+#include "GMPDecryptorParent.h"
+#include "GMPParent.h"
 #include "GMPService.h"
-#include "prio.h"
+#include "GMPVideoDecoderParent.h"
+#include "GeckoChildProcessHost.h"
+#include "MediaPrefs.h"
+#include "VideoUtils.h"
 #include "base/task.h"
 #include "mozilla/AbstractThread.h"
+#include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Logging.h"
-#include "mozilla/dom/ContentParent.h"
-#include "GMPParent.h"
-#include "GMPVideoDecoderParent.h"
-#include "nsAutoPtr.h"
-#include "nsIObserverService.h"
-#include "GeckoChildProcessHost.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/ClearOnShutdown.h"
+#include "mozilla/Services.h"
 #include "mozilla/SyncRunnable.h"
-#include "nsXPCOMPrivate.h"
-#include "mozilla/Services.h"
-#include "nsNativeCharsetUtils.h"
+#include "mozilla/Unused.h"
+#include "mozilla/dom/ContentParent.h"
+#include "nsAppDirectoryServiceDefs.h"
+#include "nsAutoPtr.h"
+#include "nsComponentManagerUtils.h"
+#include "nsDirectoryServiceDefs.h"
+#include "nsDirectoryServiceUtils.h"
+#include "nsHashKeys.h"
 #include "nsIConsoleService.h"
-#include "mozilla/Unused.h"
-#include "GMPDecryptorParent.h"
-#include "nsComponentManagerUtils.h"
+#include "nsIFile.h"
+#include "nsIObserverService.h"
+#include "nsISimpleEnumerator.h"
+#include "nsIXULRuntime.h"
+#include "nsNativeCharsetUtils.h"
+#include "nsXPCOMPrivate.h"
+#include "prio.h"
 #include "runnable_utils.h"
-#include "VideoUtils.h"
+#include <limits>
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
 #include "mozilla/SandboxInfo.h"
 #endif
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsDirectoryServiceUtils.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsHashKeys.h"
-#include "nsIFile.h"
-#include "nsISimpleEnumerator.h"
 #if defined(MOZ_CRASHREPORTER)
 #include "nsExceptionHandler.h"
 #include "nsPrintfCString.h"
 #endif
-#include "nsIXULRuntime.h"
-#include "GMPDecoderModule.h"
-#include <limits>
-#include "MediaPrefs.h"
 
 using mozilla::ipc::Transport;
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
@@ -103,24 +103,29 @@ GeckoMediaPluginServiceParent::~GeckoMed
   MOZ_ASSERT(mPlugins.IsEmpty());
 }
 
 nsresult
 GeckoMediaPluginServiceParent::Init()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
+  nsCOMPtr<nsIObserverService> obsService =
+    mozilla::services::GetObserverService();
   MOZ_ASSERT(obsService);
-  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, "profile-change-teardown", false));
-  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, "last-pb-context-exited", false));
-  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, "browser:purge-session-history", false));
+  MOZ_ALWAYS_SUCCEEDS(
+    obsService->AddObserver(this, "profile-change-teardown", false));
+  MOZ_ALWAYS_SUCCEEDS(
+    obsService->AddObserver(this, "last-pb-context-exited", false));
+  MOZ_ALWAYS_SUCCEEDS(
+    obsService->AddObserver(this, "browser:purge-session-history", false));
 
 #ifdef DEBUG
-  MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(this, "mediakeys-request", false));
+  MOZ_ALWAYS_SUCCEEDS(
+    obsService->AddObserver(this, "mediakeys-request", false));
 #endif
 
   nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefs) {
     prefs->AddObserver("media.gmp.plugin.crash", this, false);
   }
 
   nsresult rv = InitStorage();
@@ -131,27 +136,29 @@ GeckoMediaPluginServiceParent::Init()
   // Kick off scanning for plugins
   nsCOMPtr<nsIThread> thread;
   rv = GetThread(getter_AddRefs(thread));
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   // Detect if GMP storage has an incompatible version, and if so nuke it.
-  int32_t version = Preferences::GetInt("media.gmp.storage.version.observed", 0);
-  int32_t expected = Preferences::GetInt("media.gmp.storage.version.expected", 0);
+  int32_t version =
+    Preferences::GetInt("media.gmp.storage.version.observed", 0);
+  int32_t expected =
+    Preferences::GetInt("media.gmp.storage.version.expected", 0);
   if (version != expected) {
     Preferences::SetInt("media.gmp.storage.version.observed", expected);
     return GMPDispatch(NewRunnableMethod(
       this, &GeckoMediaPluginServiceParent::ClearStorage));
   }
   return NS_OK;
 }
 
-already_AddRefed<nsIFile>
+static already_AddRefed<nsIFile>
 CloneAndAppend(nsIFile* aFile, const nsAString& aDir)
 {
   nsCOMPtr<nsIFile> f;
   nsresult rv = aFile->Clone(getter_AddRefs(f));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return nullptr;
   }
 
@@ -202,19 +209,22 @@ GeckoMediaPluginServiceParent::InitStora
   // GMP storage should be used in the chrome process only.
   if (!XRE_IsParentProcess()) {
     return NS_OK;
   }
 
   // Directory service is main thread only, so cache the profile dir here
   // so that we can use it off main thread.
 #ifdef MOZ_WIDGET_GONK
-  nsresult rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/b2g/mozilla"), false, getter_AddRefs(mStorageBaseDir));
+  nsresult rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/b2g/mozilla"),
+                                false,
+                                getter_AddRefs(mStorageBaseDir));
 #else
-  nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mStorageBaseDir));
+  nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
+                                       getter_AddRefs(mStorageBaseDir));
 #endif
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   rv = mStorageBaseDir->AppendNative(NS_LITERAL_CSTRING("gmp"));
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -267,19 +277,19 @@ GeckoMediaPluginServiceParent::Observe(n
       }
       if (crashNow) {
         nsCOMPtr<nsIThread> gmpThread;
         {
           MutexAutoLock lock(mMutex);
           gmpThread = mGMPThread;
         }
         if (gmpThread) {
-          gmpThread->Dispatch(WrapRunnable(this,
-                                           &GeckoMediaPluginServiceParent::CrashPlugins),
-                              NS_DISPATCH_NORMAL);
+          gmpThread->Dispatch(
+            WrapRunnable(this, &GeckoMediaPluginServiceParent::CrashPlugins),
+            NS_DISPATCH_NORMAL);
         }
       }
     }
   } else if (!strcmp("profile-change-teardown", aTopic)) {
     mWaitingForPluginsSyncShutdown = true;
 
     nsCOMPtr<nsIThread> gmpThread;
     {
@@ -335,17 +345,18 @@ GeckoMediaPluginServiceParent::Observe(n
         this, &GeckoMediaPluginServiceParent::ClearRecentHistoryOnGMPThread,
         t));
   }
 
   return NS_OK;
 }
 
 RefPtr<GenericPromise>
-GeckoMediaPluginServiceParent::EnsureInitialized() {
+GeckoMediaPluginServiceParent::EnsureInitialized()
+{
   MonitorAutoLock lock(mInitPromiseMonitor);
   if (mLoadPluginsFromDiskComplete) {
     return GenericPromise::CreateAndResolve(true, __func__);
   }
   // We should have an init promise in flight.
   MOZ_ASSERT(!mInitPromise.IsEmpty());
   return mInitPromise.Ensure(__func__);
 }
@@ -353,34 +364,42 @@ GeckoMediaPluginServiceParent::EnsureIni
 RefPtr<GetGMPContentParentPromise>
 GeckoMediaPluginServiceParent::GetContentParent(GMPCrashHelper* aHelper,
                                                const nsACString& aNodeId,
                                                const nsCString& aAPI,
                                                const nsTArray<nsCString>& aTags)
 {
   RefPtr<AbstractThread> thread(GetAbstractGMPThread());
   if (!thread) {
-    return GetGMPContentParentPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
+    return GetGMPContentParentPromise::CreateAndReject(NS_ERROR_FAILURE,
+                                                       __func__);
   }
 
   typedef MozPromiseHolder<GetGMPContentParentPromise> PromiseHolder;
   PromiseHolder* rawHolder = new PromiseHolder();
   RefPtr<GeckoMediaPluginServiceParent> self(this);
   RefPtr<GetGMPContentParentPromise> promise = rawHolder->Ensure(__func__);
   nsCString nodeId(aNodeId);
   nsTArray<nsCString> tags(aTags);
   nsCString api(aAPI);
   RefPtr<GMPCrashHelper> helper(aHelper);
-  EnsureInitialized()->Then(thread, __func__,
+  EnsureInitialized()->Then(
+    thread,
+    __func__,
     [self, tags, api, nodeId, helper, rawHolder]() -> void {
       UniquePtr<PromiseHolder> holder(rawHolder);
       RefPtr<GMPParent> gmp = self->SelectPluginForAPI(nodeId, api, tags);
-      LOGD(("%s: %p returning %p for api %s", __FUNCTION__, (void *)self, (void *)gmp, api.get()));
+      LOGD(("%s: %p returning %p for api %s",
+            __FUNCTION__,
+            (void*)self,
+            (void*)gmp,
+            api.get()));
       if (!gmp) {
-        NS_WARNING("GeckoMediaPluginServiceParent::GetContentParentFrom failed");
+        NS_WARNING(
+          "GeckoMediaPluginServiceParent::GetContentParentFrom failed");
         holder->Reject(NS_ERROR_FAILURE, __func__);
         return;
       }
       self->ConnectCrashHelper(gmp->GetPluginId(), helper);
       gmp->GetGMPContentParent(Move(holder));
     },
     [rawHolder]() -> void {
       UniquePtr<PromiseHolder> holder(rawHolder);
@@ -398,29 +417,32 @@ GeckoMediaPluginServiceParent::Initializ
   MOZ_ASSERT(aAbstractGMPThread);
   MonitorAutoLock lock(mInitPromiseMonitor);
   if (mLoadPluginsFromDiskComplete) {
     return;
   }
 
   RefPtr<GeckoMediaPluginServiceParent> self(this);
   RefPtr<GenericPromise> p = mInitPromise.Ensure(__func__);
-  InvokeAsync(aAbstractGMPThread, this, __func__,
+  InvokeAsync(aAbstractGMPThread,
+              this,
+              __func__,
               &GeckoMediaPluginServiceParent::LoadFromEnvironment)
-    ->Then(aAbstractGMPThread, __func__,
-      [self]() -> void {
-        MonitorAutoLock lock(self->mInitPromiseMonitor);
-        self->mLoadPluginsFromDiskComplete = true;
-        self->mInitPromise.Resolve(true, __func__);
-      },
-      [self]() -> void {
-        MonitorAutoLock lock(self->mInitPromiseMonitor);
-        self->mLoadPluginsFromDiskComplete = true;
-        self->mInitPromise.Reject(NS_ERROR_FAILURE, __func__);
-      });
+    ->Then(aAbstractGMPThread,
+           __func__,
+           [self]() -> void {
+             MonitorAutoLock lock(self->mInitPromiseMonitor);
+             self->mLoadPluginsFromDiskComplete = true;
+             self->mInitPromise.Resolve(true, __func__);
+           },
+           [self]() -> void {
+             MonitorAutoLock lock(self->mInitPromiseMonitor);
+             self->mLoadPluginsFromDiskComplete = true;
+             self->mInitPromise.Reject(NS_ERROR_FAILURE, __func__);
+           });
 }
 
 void
 GeckoMediaPluginServiceParent::NotifySyncShutdownComplete()
 {
   MOZ_ASSERT(NS_IsMainThread());
   mWaitingForPluginsSyncShutdown = false;
 }
@@ -479,65 +501,74 @@ GeckoMediaPluginServiceParent::CrashPlug
 }
 
 RefPtr<GenericPromise::AllPromiseType>
 GeckoMediaPluginServiceParent::LoadFromEnvironment()
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
   RefPtr<AbstractThread> thread(GetAbstractGMPThread());
   if (!thread) {
-    return GenericPromise::AllPromiseType::CreateAndReject(NS_ERROR_FAILURE, __func__);
+    return GenericPromise::AllPromiseType::CreateAndReject(NS_ERROR_FAILURE,
+                                                           __func__);
   }
 
   const char* env = PR_GetEnv("MOZ_GMP_PATH");
   if (!env || !*env) {
     return GenericPromise::AllPromiseType::CreateAndResolve(true, __func__);
   }
 
   nsString allpaths;
-  if (NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(env), allpaths)))) {
-    return GenericPromise::AllPromiseType::CreateAndReject(NS_ERROR_FAILURE, __func__);
+  if (NS_WARN_IF(
+        NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(env), allpaths)))) {
+    return GenericPromise::AllPromiseType::CreateAndReject(NS_ERROR_FAILURE,
+                                                           __func__);
   }
 
   nsTArray<RefPtr<GenericPromise>> promises;
   uint32_t pos = 0;
   while (pos < allpaths.Length()) {
     // Loop over multiple path entries separated by colons (*nix) or
     // semicolons (Windows)
     int32_t next = allpaths.FindChar(XPCOM_ENV_PATH_SEPARATOR[0], pos);
     if (next == -1) {
-      promises.AppendElement(AddOnGMPThread(nsString(Substring(allpaths, pos))));
+      promises.AppendElement(
+        AddOnGMPThread(nsString(Substring(allpaths, pos))));
       break;
     } else {
-      promises.AppendElement(AddOnGMPThread(nsString(Substring(allpaths, pos, next - pos))));
+      promises.AppendElement(
+        AddOnGMPThread(nsString(Substring(allpaths, pos, next - pos))));
       pos = next + 1;
     }
   }
 
   mScannedPluginOnDisk = true;
   return GenericPromise::All(thread, promises);
 }
 
-class NotifyObserversTask final : public mozilla::Runnable {
+class NotifyObserversTask final : public mozilla::Runnable
+{
 public:
   explicit NotifyObserversTask(const char* aTopic, nsString aData = EmptyString())
     : mTopic(aTopic)
     , mData(aData)
-  {}
-  NS_IMETHOD Run() override {
+  {
+  }
+  NS_IMETHOD Run() override
+  {
     MOZ_ASSERT(NS_IsMainThread());
-    nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
+    nsCOMPtr<nsIObserverService> obsService =
+      mozilla::services::GetObserverService();
     MOZ_ASSERT(obsService);
     if (obsService) {
       obsService->NotifyObservers(nullptr, mTopic, mData.get());
     }
     return NS_OK;
   }
 private:
-  ~NotifyObserversTask() {}
+  ~NotifyObserversTask() { }
   const char* mTopic;
   const nsString mData;
 };
 
 NS_IMETHODIMP
 GeckoMediaPluginServiceParent::PathRunnable::Run()
 {
   mService->RemoveOnGMPThread(mPath,
@@ -547,18 +578,19 @@ GeckoMediaPluginServiceParent::PathRunna
   mService->UpdateContentProcessGMPCapabilities();
   return NS_OK;
 }
 
 void
 GeckoMediaPluginServiceParent::UpdateContentProcessGMPCapabilities()
 {
   if (!NS_IsMainThread()) {
-    nsCOMPtr<nsIRunnable> task =
-      NewRunnableMethod(this, &GeckoMediaPluginServiceParent::UpdateContentProcessGMPCapabilities);
+    nsCOMPtr<nsIRunnable> task = NewRunnableMethod(
+      this,
+      &GeckoMediaPluginServiceParent::UpdateContentProcessGMPCapabilities);
     NS_DispatchToMainThread(task);
     return;
   }
 
   typedef mozilla::dom::GMPCapabilityData GMPCapabilityData;
   typedef mozilla::dom::GMPAPITags GMPAPITags;
   typedef mozilla::dom::ContentParent ContentParent;
 
@@ -598,54 +630,61 @@ GeckoMediaPluginServiceParent::UpdateCon
   nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
   MOZ_ASSERT(obsService);
   if (obsService) {
     obsService->NotifyObservers(nullptr, "gmp-changed", nullptr);
   }
 }
 
 RefPtr<GenericPromise>
-GeckoMediaPluginServiceParent::AsyncAddPluginDirectory(const nsAString& aDirectory)
+GeckoMediaPluginServiceParent::AsyncAddPluginDirectory(
+  const nsAString& aDirectory)
 {
   RefPtr<AbstractThread> thread(GetAbstractGMPThread());
   if (!thread) {
     return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
   }
 
   nsString dir(aDirectory);
   RefPtr<GeckoMediaPluginServiceParent> self = this;
-  return InvokeAsync<nsString&&>(
-           thread, this, __func__,
-           &GeckoMediaPluginServiceParent::AddOnGMPThread, dir)
+  return InvokeAsync<nsString&&>(thread,
+                                 this,
+                                 __func__,
+                                 &GeckoMediaPluginServiceParent::AddOnGMPThread,
+                                 dir)
     ->Then(
-      AbstractThread::MainThread(), // Non DocGroup-version for the task in parent.
+      AbstractThread::MainThread(), // Non DocGroup-version for the task in
+                                    // parent.
       __func__,
       [dir, self]() -> void {
-        LOGD(("GeckoMediaPluginServiceParent::AsyncAddPluginDirectory %s succeeded",
-              NS_ConvertUTF16toUTF8(dir).get()));
+        LOGD((
+          "GeckoMediaPluginServiceParent::AsyncAddPluginDirectory %s succeeded",
+          NS_ConvertUTF16toUTF8(dir).get()));
         MOZ_ASSERT(NS_IsMainThread());
         self->UpdateContentProcessGMPCapabilities();
       },
       [dir]() -> void {
-        LOGD(("GeckoMediaPluginServiceParent::AsyncAddPluginDirectory %s failed",
-              NS_ConvertUTF16toUTF8(dir).get()));
+        LOGD(
+          ("GeckoMediaPluginServiceParent::AsyncAddPluginDirectory %s failed",
+           NS_ConvertUTF16toUTF8(dir).get()));
       });
 }
 
 NS_IMETHODIMP
 GeckoMediaPluginServiceParent::AddPluginDirectory(const nsAString& aDirectory)
 {
   MOZ_ASSERT(NS_IsMainThread());
   RefPtr<GenericPromise> p = AsyncAddPluginDirectory(aDirectory);
   Unused << p;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-GeckoMediaPluginServiceParent::RemovePluginDirectory(const nsAString& aDirectory)
+GeckoMediaPluginServiceParent::RemovePluginDirectory(
+  const nsAString& aDirectory)
 {
   MOZ_ASSERT(NS_IsMainThread());
   return GMPDispatch(new PathRunnable(this, aDirectory,
                                       PathRunnable::EOperation::REMOVE));
 }
 
 NS_IMETHODIMP
 GeckoMediaPluginServiceParent::RemoveAndDeletePluginDirectory(
@@ -698,39 +737,41 @@ GeckoMediaPluginServiceParent::EnsurePlu
     NS_ENSURE_SUCCESS(rv, rv);
     MOZ_ASSERT(mScannedPluginOnDisk, "Should have scanned MOZ_GMP_PATH by now");
   }
 
   return NS_OK;
 }
 
 already_AddRefed<GMPParent>
-GeckoMediaPluginServiceParent::FindPluginForAPIFrom(size_t aSearchStartIndex,
-                                                    const nsCString& aAPI,
-                                                    const nsTArray<nsCString>& aTags,
-                                                    size_t* aOutPluginIndex)
+GeckoMediaPluginServiceParent::FindPluginForAPIFrom(
+  size_t aSearchStartIndex,
+  const nsCString& aAPI,
+  const nsTArray<nsCString>& aTags,
+  size_t* aOutPluginIndex)
 {
   mMutex.AssertCurrentThreadOwns();
   for (size_t i = aSearchStartIndex; i < mPlugins.Length(); i++) {
     RefPtr<GMPParent> gmp = mPlugins[i];
     if (!GMPCapability::Supports(gmp->GetCapabilities(), aAPI, aTags)) {
       continue;
     }
     if (aOutPluginIndex) {
       *aOutPluginIndex = i;
     }
     return gmp.forget();
   }
   return nullptr;
 }
 
 already_AddRefed<GMPParent>
-GeckoMediaPluginServiceParent::SelectPluginForAPI(const nsACString& aNodeId,
-                                                  const nsCString& aAPI,
-                                                  const nsTArray<nsCString>& aTags)
+GeckoMediaPluginServiceParent::SelectPluginForAPI(
+  const nsACString& aNodeId,
+  const nsCString& aAPI,
+  const nsTArray<nsCString>& aTags)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread,
              "Can't clone GMP plugins on non-GMP threads.");
 
   GMPParent* gmpToClone = nullptr;
   {
     MutexAutoLock lock(mMutex);
     size_t index = 0;
@@ -772,17 +813,17 @@ GeckoMediaPluginServiceParent::SelectPlu
       clone->SetNodeId(aNodeId);
     }
     return clone.forget();
   }
 
   return nullptr;
 }
 
-RefPtr<GMPParent>
+static RefPtr<GMPParent>
 CreateGMPParent()
 {
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
   if (!SandboxInfo::Get().CanSandboxMedia()) {
     if (!MediaPrefs::GMPAllowInsecure()) {
       NS_WARNING("Denying media plugin load due to lack of sandboxing.");
       return nullptr;
     }
@@ -826,17 +867,21 @@ GeckoMediaPluginServiceParent::AddOnGMPT
     LOGD(("%s::%s: %s No GMP Thread", __CLASS__, __FUNCTION__, dir.get()));
     return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
   }
   LOGD(("%s::%s: %s", __CLASS__, __FUNCTION__, dir.get()));
 
   nsCOMPtr<nsIFile> directory;
   nsresult rv = NS_NewLocalFile(aDirectory, false, getter_AddRefs(directory));
   if (NS_WARN_IF(NS_FAILED(rv))) {
-    LOGD(("%s::%s: failed to create nsIFile for dir=%s rv=%x", __CLASS__, __FUNCTION__, dir.get(), rv));
+    LOGD(("%s::%s: failed to create nsIFile for dir=%s rv=%x",
+          __CLASS__,
+          __FUNCTION__,
+          dir.get(),
+          rv));
     return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
   }
 
   RefPtr<GMPParent> gmp = CreateGMPParent();
   if (!gmp) {
     NS_WARNING("Can't Create GMPParent");
     return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
   }
@@ -856,17 +901,20 @@ GeckoMediaPluginServiceParent::AddOnGMPT
 }
 
 void
 GeckoMediaPluginServiceParent::RemoveOnGMPThread(const nsAString& aDirectory,
                                                  const bool aDeleteFromDisk,
                                                  const bool aCanDefer)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
-  LOGD(("%s::%s: %s", __CLASS__, __FUNCTION__, NS_LossyConvertUTF16toASCII(aDirectory).get()));
+  LOGD(("%s::%s: %s",
+        __CLASS__,
+        __FUNCTION__,
+        NS_LossyConvertUTF16toASCII(aDirectory).get()));
 
   nsCOMPtr<nsIFile> directory;
   nsresult rv = NS_NewLocalFile(aDirectory, false, getter_AddRefs(directory));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return;
   }
 
   // Plugin destruction can modify |mPlugins|. Put them aside for now and
@@ -928,17 +976,18 @@ GeckoMediaPluginServiceParent::RemoveOnG
 // May remove when Bug 1043671 is fixed
 static void Dummy(RefPtr<GMPParent>& aOnDeathsDoor)
 {
   // exists solely to do nothing and let the Runnable kill the GMPParent
   // when done.
 }
 
 void
-GeckoMediaPluginServiceParent::PluginTerminated(const RefPtr<GMPParent>& aPlugin)
+GeckoMediaPluginServiceParent::PluginTerminated(
+  const RefPtr<GMPParent>& aPlugin)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
 
   if (aPlugin->IsMarkedForDeletion()) {
     nsCString path8;
     RefPtr<nsIFile> dir = aPlugin->GetDirectory();
     nsresult rv = dir->GetNativePath(path8);
     NS_ENSURE_SUCCESS_VOID(rv);
@@ -1073,18 +1122,19 @@ GeckoMediaPluginServiceParent::GetMemory
   if (!mTempGMPStorage.Get(aNodeId, getter_AddRefs(s))) {
     s = CreateGMPMemoryStorage();
     mTempGMPStorage.Put(aNodeId, s);
   }
   return s.forget();
 }
 
 NS_IMETHODIMP
-GeckoMediaPluginServiceParent::IsPersistentStorageAllowed(const nsACString& aNodeId,
-                                                          bool* aOutAllowed)
+GeckoMediaPluginServiceParent::IsPersistentStorageAllowed(
+  const nsACString& aNodeId,
+  bool* aOutAllowed)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
   NS_ENSURE_ARG(aOutAllowed);
   // We disallow persistent storage for the NodeId used for shared GMP
   // decoding, to prevent GMP decoding being used to track what a user
   // watches somehow.
   *aOutAllowed = !aNodeId.Equals(SHARED_GMP_DECODING_NODE_ID) &&
                  mPersistentStorageAllowed.Get(aNodeId);
@@ -1099,20 +1149,20 @@ GeckoMediaPluginServiceParent::GetNodeId
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
   LOGD(("%s::%s: (%s, %s)", __CLASS__, __FUNCTION__,
        NS_ConvertUTF16toUTF8(aOrigin).get(),
        NS_ConvertUTF16toUTF8(aTopLevelOrigin).get()));
 
   nsresult rv;
 
-  if (aOrigin.EqualsLiteral("null") ||
-      aOrigin.IsEmpty() ||
-      aTopLevelOrigin.EqualsLiteral("null") ||
-      aTopLevelOrigin.IsEmpty()) {
+  if (aOrigin.EqualsLiteral("null")
+      || aOrigin.IsEmpty()
+      || aTopLevelOrigin.EqualsLiteral("null")
+      || aTopLevelOrigin.IsEmpty()) {
     // (origin, topLevelOrigin) is null or empty; this is for an anonymous
     // origin, probably a local file, for which we don't provide persistent storage.
     // Generate a random node id, and don't store it so that the GMP's storage
     // is temporary and the process for this GMP is not shared with GMP
     // instances that have the same nodeId.
     nsAutoCString salt;
     rv = GenerateRandomPathName(salt, NodeIdSaltLength);
     if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -1248,20 +1298,21 @@ GeckoMediaPluginServiceParent::GetNodeId
 
   aOutId = salt;
   mPersistentStorageAllowed.Put(salt, true);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-GeckoMediaPluginServiceParent::GetNodeId(const nsAString& aOrigin,
-                                         const nsAString& aTopLevelOrigin,
-                                         const nsAString& aGMPName,
-                                         UniquePtr<GetNodeIdCallback>&& aCallback)
+GeckoMediaPluginServiceParent::GetNodeId(
+  const nsAString& aOrigin,
+  const nsAString& aTopLevelOrigin,
+  const nsAString& aGMPName,
+  UniquePtr<GetNodeIdCallback>&& aCallback)
 {
   nsCString nodeId;
   nsresult rv = GetNodeId(aOrigin, aTopLevelOrigin, aGMPName, nodeId);
   aCallback->Done(rv, nodeId);
   return rv;
 }
 
 static bool
@@ -1300,30 +1351,33 @@ MatchOrigin(nsIFile* aPath,
   mozilla::OriginAttributes originAttributes;
 
   rv = ReadFromFile(aPath, NS_LITERAL_CSTRING("origin"), str, MaxDomainLength);
   if (!originAttributes.PopulateFromOrigin(str, originNoSuffix)) {
     // Fails on parsing the originAttributes, treat this as a non-match.
     return false;
   }
 
-  if (NS_SUCCEEDED(rv) && ExtractHostName(originNoSuffix, str) && str.Equals(aSite) &&
-      aPattern.Matches(originAttributes)) {
+  if (NS_SUCCEEDED(rv) && ExtractHostName(originNoSuffix, str)
+      && str.Equals(aSite)
+      && aPattern.Matches(originAttributes)) {
     return true;
   }
 
   mozilla::OriginAttributes topLevelOriginAttributes;
   rv = ReadFromFile(aPath, NS_LITERAL_CSTRING("topLevelOrigin"), str, MaxDomainLength);
   if (!topLevelOriginAttributes.PopulateFromOrigin(str, originNoSuffix)) {
     // Fails on paring the originAttributes, treat this as a non-match.
     return false;
   }
 
-  if (NS_SUCCEEDED(rv) && ExtractHostName(originNoSuffix, str) && str.Equals(aSite) &&
-      aPattern.Matches(topLevelOriginAttributes)) {
+  if (NS_SUCCEEDED(rv)
+      && ExtractHostName(originNoSuffix, str)
+      && str.Equals(aSite)
+      && aPattern.Matches(topLevelOriginAttributes)) {
     return true;
   }
   return false;
 }
 
 template<typename T> static void
 KillPlugins(const nsTArray<RefPtr<GMPParent>>& aPlugins,
             Mutex& aMutex, T&& aFilter)
@@ -1360,48 +1414,53 @@ DeleteDir(nsIFile* aPath)
   }
   if (exists) {
     return aPath->Remove(true);
   }
   return NS_OK;
 }
 
 struct NodeFilter {
-  explicit NodeFilter(const nsTArray<nsCString>& nodeIDs) : mNodeIDs(nodeIDs) {}
-  bool operator()(GMPParent* aParent) {
+  explicit NodeFilter(const nsTArray<nsCString>& nodeIDs)
+    : mNodeIDs(nodeIDs)
+  {
+  }
+  bool operator()(GMPParent* aParent)
+  {
     return mNodeIDs.Contains(aParent->GetNodeId());
   }
 private:
   const nsTArray<nsCString>& mNodeIDs;
 };
 
 void
 GeckoMediaPluginServiceParent::ClearNodeIdAndPlugin(DirectoryFilter& aFilter)
 {
   // $profileDir/gmp/$platform/
   nsCOMPtr<nsIFile> path;
   nsresult rv = GetStorageDir(getter_AddRefs(path));
   if (NS_FAILED(rv)) {
     return;
   }
 
-  // Iterate all sub-folders of $profileDir/gmp/$platform/, i.e. the dirs in which
-  // specific GMPs store their data.
+  // Iterate all sub-folders of $profileDir/gmp/$platform/, i.e. the dirs in
+  // which specific GMPs store their data.
   DirectoryEnumerator iter(path, DirectoryEnumerator::DirsOnly);
   for (nsCOMPtr<nsIFile> pluginDir; (pluginDir = iter.Next()) != nullptr;) {
     ClearNodeIdAndPlugin(pluginDir, aFilter);
   }
 }
 
 void
 GeckoMediaPluginServiceParent::ClearNodeIdAndPlugin(nsIFile* aPluginStorageDir,
                                                     DirectoryFilter& aFilter)
 {
   // $profileDir/gmp/$platform/$gmpName/id/
-  nsCOMPtr<nsIFile> path = CloneAndAppend(aPluginStorageDir, NS_LITERAL_STRING("id"));
+  nsCOMPtr<nsIFile> path =
+    CloneAndAppend(aPluginStorageDir, NS_LITERAL_STRING("id"));
   if (!path) {
     return;
   }
 
   // Iterate all sub-folders of $profileDir/gmp/$platform/$gmpName/id/
   nsTArray<nsCString> nodeIDsToClear;
   DirectoryEnumerator iter(path, DirectoryEnumerator::DirsOnly);
   for (nsCOMPtr<nsIFile> dirEntry; (dirEntry = iter.Next()) != nullptr;) {
@@ -1446,18 +1505,19 @@ GeckoMediaPluginServiceParent::ClearNode
 
     if (NS_FAILED(DeleteDir(dirEntry))) {
       NS_WARNING("Failed to delete GMP storage directory for the node");
     }
   }
 }
 
 void
-GeckoMediaPluginServiceParent::ForgetThisSiteOnGMPThread(const nsACString& aSite,
-                                                         const mozilla::OriginAttributesPattern& aPattern)
+GeckoMediaPluginServiceParent::ForgetThisSiteOnGMPThread(
+  const nsACString& aSite,
+  const mozilla::OriginAttributesPattern& aPattern)
 {
   MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
   LOGD(("%s::%s: origin=%s", __CLASS__, __FUNCTION__, aSite.Data()));
 
   struct OriginFilter : public DirectoryFilter {
     explicit OriginFilter(const nsACString& aSite,
                           const mozilla::OriginAttributesPattern& aPattern)
     : mSite(aSite)
@@ -1496,17 +1556,18 @@ GeckoMediaPluginServiceParent::ClearRece
         if (IsModifiedAfter(dirEntry)) {
           return true;
         }
       }
       return false;
     }
 
     // |aPath| is $profileDir/gmp/$platform/$gmpName/id/$originHash/
-    bool operator()(nsIFile* aPath) override {
+    bool operator()(nsIFile* aPath) override
+    {
       if (IsModifiedAfter(aPath)) {
         return true;
       }
 
       nsAutoCString salt;
       if (NS_FAILED(ReadSalt(aPath, salt))) {
         return false;
       }
@@ -1524,23 +1585,25 @@ GeckoMediaPluginServiceParent::ClearRece
 
       // $profileDir/gmp/$platform/$gmpName/storage/
       if (NS_FAILED(temp->Append(NS_LITERAL_STRING("storage")))) {
         return false;
       }
       // $profileDir/gmp/$platform/$gmpName/storage/$originSalt
       return NS_SUCCEEDED(temp->AppendNative(salt)) && IsModifiedAfter(temp);
     }
+
   private:
     const PRTime mSince;
   } filter(aSince);
 
   ClearNodeIdAndPlugin(filter);
 
-  NS_DispatchToMainThread(new NotifyObserversTask("gmp-clear-storage-complete"), NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(new NotifyObserversTask("gmp-clear-storage-complete"),
+                          NS_DISPATCH_NORMAL);
 }
 
 NS_IMETHODIMP
 GeckoMediaPluginServiceParent::ForgetThisSite(const nsAString& aSite,
                                               const nsAString& aPattern)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -1549,27 +1612,32 @@ GeckoMediaPluginServiceParent::ForgetThi
   if (!pattern.Init(aPattern)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   return ForgetThisSiteNative(aSite, pattern);
 }
 
 nsresult
-GeckoMediaPluginServiceParent::ForgetThisSiteNative(const nsAString& aSite,
-                                                    const mozilla::OriginAttributesPattern& aPattern)
+GeckoMediaPluginServiceParent::ForgetThisSiteNative(
+  const nsAString& aSite,
+  const mozilla::OriginAttributesPattern& aPattern)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  return GMPDispatch(NewRunnableMethod<nsCString, mozilla::OriginAttributesPattern>(
-      this, &GeckoMediaPluginServiceParent::ForgetThisSiteOnGMPThread,
-      NS_ConvertUTF16toUTF8(aSite), aPattern));
+  return GMPDispatch(
+    NewRunnableMethod<nsCString, mozilla::OriginAttributesPattern>(
+      this,
+      &GeckoMediaPluginServiceParent::ForgetThisSiteOnGMPThread,
+      NS_ConvertUTF16toUTF8(aSite),
+      aPattern));
 }
 
-static bool IsNodeIdValid(GMPParent* aParent) {
+static bool IsNodeIdValid(GMPParent* aParent)
+{
   return !aParent->GetNodeId().IsEmpty();
 }
 
 static nsCOMPtr<nsIAsyncShutdownClient>
 GetShutdownBarrier()
 {
   nsCOMPtr<nsIAsyncShutdownService> svc = services::GetAsyncShutdown();
   MOZ_RELEASE_ASSERT(svc);
@@ -1640,17 +1708,18 @@ GeckoMediaPluginServiceParent::ClearStor
 
   if (NS_FAILED(DeleteDir(path))) {
     NS_WARNING("Failed to delete GMP storage directory");
   }
 
   // Clear private-browsing storage.
   mTempGMPStorage.Clear();
 
-  NS_DispatchToMainThread(new NotifyObserversTask("gmp-clear-storage-complete"), NS_DISPATCH_NORMAL);
+  NS_DispatchToMainThread(new NotifyObserversTask("gmp-clear-storage-complete"),
+                          NS_DISPATCH_NORMAL);
 }
 
 already_AddRefed<GMPParent>
 GeckoMediaPluginServiceParent::GetById(uint32_t aPluginId)
 {
   MutexAutoLock lock(mMutex);
   for (const RefPtr<GMPParent>& gmp : mPlugins) {
     if (gmp->GetPluginId() == aPluginId) {
@@ -1771,21 +1840,18 @@ void GMPServiceParent::CloseTransport(Mo
 void
 GMPServiceParent::ActorDestroy(ActorDestroyReason aWhy)
 {
   Monitor monitor("DeleteGMPServiceParent");
   bool completed = false;
 
   // Make sure the IPC channel is closed before destroying mToDelete.
   MonitorAutoLock lock(monitor);
-  RefPtr<Runnable> task =
-    NewNonOwningRunnableMethod<Monitor*, bool*>(this,
-                                                &GMPServiceParent::CloseTransport,
-                                                &monitor,
-                                                &completed);
+  RefPtr<Runnable> task = NewNonOwningRunnableMethod<Monitor*, bool*>(
+    this, &GMPServiceParent::CloseTransport, &monitor, &completed);
   XRE_GetIOMessageLoop()->PostTask(Move(task.forget()));
 
   while (!completed) {
     lock.Wait();
   }
 
   NS_DispatchToCurrentThread(new DeleteGMPServiceParent(this));
 }
--- a/dom/media/gmp/GMPServiceParent.h
+++ b/dom/media/gmp/GMPServiceParent.h
@@ -2,25 +2,25 @@
 /* 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 GMPServiceParent_h_
 #define GMPServiceParent_h_
 
 #include "GMPService.h"
+#include "GMPStorage.h"
+#include "mozIGeckoMediaPluginChromeService.h"
+#include "mozilla/Atomics.h"
+#include "mozilla/MozPromise.h"
 #include "mozilla/gmp/PGMPServiceParent.h"
-#include "mozIGeckoMediaPluginChromeService.h"
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
-#include "mozilla/Atomics.h"
 #include "nsIAsyncShutdown.h"
 #include "nsThreadUtils.h"
-#include "mozilla/MozPromise.h"
-#include "GMPStorage.h"
 
 template <class> struct already_AddRefed;
 
 namespace mozilla {
 namespace gmp {
 
 class GMPParent;
 
@@ -51,40 +51,43 @@ public:
 
   RefPtr<GenericPromise> EnsureInitialized();
   RefPtr<GenericPromise> AsyncAddPluginDirectory(const nsAString& aDirectory);
 
   // GMP thread access only
   bool IsShuttingDown();
 
   already_AddRefed<GMPStorage> GetMemoryStorageFor(const nsACString& aNodeId);
-  nsresult ForgetThisSiteNative(const nsAString& aSite,
-                                const mozilla::OriginAttributesPattern& aPattern);
+  nsresult ForgetThisSiteNative(
+    const nsAString& aSite,
+    const mozilla::OriginAttributesPattern& aPattern);
 
   // Notifies that some user of this class is created/destroyed.
   void ServiceUserCreated();
   void ServiceUserDestroyed();
 
   void UpdateContentProcessGMPCapabilities();
 
 private:
   friend class GMPServiceParent;
 
   virtual ~GeckoMediaPluginServiceParent();
 
   void ClearStorage();
 
-  already_AddRefed<GMPParent> SelectPluginForAPI(const nsACString& aNodeId,
-                                                 const nsCString& aAPI,
-                                                 const nsTArray<nsCString>& aTags);
+  already_AddRefed<GMPParent> SelectPluginForAPI(
+    const nsACString& aNodeId,
+    const nsCString& aAPI,
+    const nsTArray<nsCString>& aTags);
 
-  already_AddRefed<GMPParent> FindPluginForAPIFrom(size_t aSearchStartIndex,
-                                                   const nsCString& aAPI,
-                                                   const nsTArray<nsCString>& aTags,
-                                                   size_t* aOutPluginIndex);
+  already_AddRefed<GMPParent> FindPluginForAPIFrom(
+    size_t aSearchStartIndex,
+    const nsCString& aAPI,
+    const nsTArray<nsCString>& aTags,
+    size_t* aOutPluginIndex);
 
   nsresult GetNodeId(const nsAString& aOrigin, const nsAString& aTopLevelOrigin,
                      const nsAString& aGMPName, nsACString& aOutId);
 
   void UnloadPlugins();
   void CrashPlugins();
   void NotifySyncShutdownComplete();
 
@@ -96,18 +99,19 @@ private:
 
   struct DirectoryFilter {
     virtual bool operator()(nsIFile* aPath) = 0;
     ~DirectoryFilter() {}
   };
   void ClearNodeIdAndPlugin(DirectoryFilter& aFilter);
   void ClearNodeIdAndPlugin(nsIFile* aPluginStorageDir,
                             DirectoryFilter& aFilter);
-  void ForgetThisSiteOnGMPThread(const nsACString& aOrigin,
-                                 const mozilla::OriginAttributesPattern& aPattern);
+  void ForgetThisSiteOnGMPThread(
+    const nsACString& aOrigin,
+    const mozilla::OriginAttributesPattern& aPattern);
   void ClearRecentHistoryOnGMPThread(PRTime aSince);
 
   already_AddRefed<GMPParent> GetById(uint32_t aPluginId);
 
 protected:
   friend class GMPParent;
   void ReAddOnGMPThread(const RefPtr<GMPParent>& aOld);
   void PluginTerminated(const RefPtr<GMPParent>& aOld);
@@ -126,28 +130,32 @@ private:
   // adding this to GeckoMediaPluginServiceParent::mPlugins.
   already_AddRefed<GMPParent> ClonePlugin(const GMPParent* aOriginal);
   nsresult EnsurePluginsOnDiskScanned();
   nsresult InitStorage();
 
   class PathRunnable : public Runnable
   {
   public:
-    enum EOperation {
+    enum EOperation
+    {
       REMOVE,
       REMOVE_AND_DELETE_FROM_DISK,
     };
 
-    PathRunnable(GeckoMediaPluginServiceParent* aService, const nsAString& aPath,
-                 EOperation aOperation, bool aDefer = false)
+    PathRunnable(GeckoMediaPluginServiceParent* aService,
+                 const nsAString& aPath,
+                 EOperation aOperation,
+                 bool aDefer = false)
       : mService(aService)
       , mPath(aPath)
       , mOperation(aOperation)
       , mDefer(aDefer)
-    { }
+    {
+    }
 
     NS_DECL_NSIRUNNABLE
 
   private:
     RefPtr<GeckoMediaPluginServiceParent> mService;
     nsString mPath;
     EOperation mOperation;
     bool mDefer;
@@ -157,22 +165,22 @@ private:
   nsTArray<RefPtr<GMPParent>> mPlugins;
   bool mShuttingDown;
 
   // True if we've inspected MOZ_GMP_PATH on the GMP thread and loaded any
   // plugins found there into mPlugins.
   Atomic<bool> mScannedPluginOnDisk;
 
   template<typename T>
-  class MainThreadOnly {
+  class MainThreadOnly
+  {
   public:
-    MOZ_IMPLICIT MainThreadOnly(T aValue)
-      : mValue(aValue)
-    {}
-    operator T&() {
+    MOZ_IMPLICIT MainThreadOnly(T aValue) : mValue(aValue) { }
+    operator T&()
+    {
       MOZ_ASSERT(NS_IsMainThread());
       return mValue;
     }
 
   private:
     T mValue;
   };
 
@@ -222,25 +230,26 @@ public:
   mozilla::ipc::IPCResult RecvGetGMPNodeId(const nsString& aOrigin,
                                            const nsString& aTopLevelOrigin,
                                            const nsString& aGMPName,
                                            nsCString* aID) override;
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
   static bool Create(Endpoint<PGMPServiceParent>&& aGMPService);
 
-  mozilla::ipc::IPCResult RecvLaunchGMP(const nsCString& aNodeId,
-                                        const nsCString& aAPI,
-                                        nsTArray<nsCString>&& aTags,
-                                        nsTArray<ProcessId>&& aAlreadyBridgedTo,
-                                        uint32_t* aOutPluginId,
-                                        ProcessId* aOutID,
-                                        nsCString* aOutDisplayName,
-                                        Endpoint<PGMPContentParent>* aOutEndpoint,
-                                        nsresult* aOutRv) override;
+  mozilla::ipc::IPCResult RecvLaunchGMP(
+    const nsCString& aNodeId,
+    const nsCString& aAPI,
+    nsTArray<nsCString>&& aTags,
+    nsTArray<ProcessId>&& aAlreadyBridgedTo,
+    uint32_t* aOutPluginId,
+    ProcessId* aOutID,
+    nsCString* aOutDisplayName,
+    Endpoint<PGMPContentParent>* aOutEndpoint,
+    nsresult* aOutRv) override;
 
 private:
   void CloseTransport(Monitor* aSyncMonitor, bool* aCompleted);
 
   RefPtr<GeckoMediaPluginServiceParent> mService;
 };
 
 } // namespace gmp
--- a/dom/media/gmp/GMPSharedMemManager.cpp
+++ b/dom/media/gmp/GMPSharedMemManager.cpp
@@ -1,33 +1,35 @@
 /* -*- 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/. */
 
 #include "GMPSharedMemManager.h"
 #include "GMPMessageUtils.h"
-#include "mozilla/ipc/SharedMemory.h"
+#include "mozilla/ClearOnShutdown.h"
 #include "mozilla/StaticPtr.h"
-#include "mozilla/ClearOnShutdown.h"
+#include "mozilla/ipc/SharedMemory.h"
 
 namespace mozilla {
 namespace gmp {
 
 // Really one set of pools on each side of the plugin API.
 
 // YUV buffers go from Encoder parent to child; pool there, and then return
 // with Decoded() frames to the Decoder parent and goes into the parent pool.
 // Compressed (encoded) data goes from the Decoder parent to the child;
 // pool there, and then return with Encoded() frames and goes into the parent
 // pool.
 bool
-GMPSharedMemManager::MgrAllocShmem(GMPSharedMem::GMPMemoryClasses aClass, size_t aSize,
-                                   ipc::Shmem::SharedMemory::SharedMemoryType aType,
-                                   ipc::Shmem* aMem)
+GMPSharedMemManager::MgrAllocShmem(
+  GMPSharedMem::GMPMemoryClasses aClass,
+  size_t aSize,
+  ipc::Shmem::SharedMemory::SharedMemoryType aType,
+  ipc::Shmem* aMem)
 {
   mData->CheckThread();
 
   // first look to see if we have a free buffer large enough
   for (uint32_t i = 0; i < GetGmpFreelist(aClass).Length(); i++) {
     MOZ_ASSERT(GetGmpFreelist(aClass)[i].IsWritable());
     if (aSize <= GetGmpFreelist(aClass)[i].Size<uint8_t>()) {
       *aMem = GetGmpFreelist(aClass)[i];
@@ -44,17 +46,18 @@ GMPSharedMemManager::MgrAllocShmem(GMPSh
     // The allocator (or NeedsShmem call) should never return less than we ask for...
     MOZ_ASSERT(aMem->Size<uint8_t>() >= aSize);
     mData->mGmpAllocated[aClass]++;
   }
   return retval;
 }
 
 bool
-GMPSharedMemManager::MgrDeallocShmem(GMPSharedMem::GMPMemoryClasses aClass, ipc::Shmem& aMem)
+GMPSharedMemManager::MgrDeallocShmem(GMPSharedMem::GMPMemoryClasses aClass,
+                                     ipc::Shmem& aMem)
 {
   mData->CheckThread();
 
   size_t size = aMem.Size<uint8_t>();
   size_t total = 0;
 
   // XXX Bug NNNNNNN Until we put better guards on ipc::shmem, verify we
   // weren't fed an shmem we already had.
--- a/dom/media/gmp/GMPSharedMemManager.h
+++ b/dom/media/gmp/GMPSharedMemManager.h
@@ -27,49 +27,55 @@ public:
   // in-use for the encoder and decoder at the given moment and not yet
   // returned to the parent pool (which is not included).  If more than
   // this are needed, we presume the client has either crashed or hung
   // (perhaps temporarily).
   static const uint32_t kGMPBufLimit = 20;
 
   GMPSharedMem()
   {
-    for (size_t i = 0; i < sizeof(mGmpAllocated)/sizeof(mGmpAllocated[0]); i++) {
+    for (size_t i = 0; i < sizeof(mGmpAllocated) / sizeof(mGmpAllocated[0]);
+         i++) {
       mGmpAllocated[i] = 0;
     }
   }
-  virtual ~GMPSharedMem() {}
+  virtual ~GMPSharedMem() { }
 
   // Parent and child impls will differ here
   virtual void CheckThread() = 0;
 
 protected:
   friend class GMPSharedMemManager;
 
   nsTArray<ipc::Shmem> mGmpFreelist[GMPSharedMem::kGMPNumTypes];
   uint32_t mGmpAllocated[GMPSharedMem::kGMPNumTypes];
 };
 
 class GMPSharedMemManager
 {
 public:
-  explicit GMPSharedMemManager(GMPSharedMem *aData) : mData(aData) {}
+  explicit GMPSharedMemManager(GMPSharedMem *aData) : mData(aData) { }
   virtual ~GMPSharedMemManager() {}
 
-  virtual bool MgrAllocShmem(GMPSharedMem::GMPMemoryClasses aClass, size_t aSize,
+  virtual bool MgrAllocShmem(GMPSharedMem::GMPMemoryClasses aClass,
+                             size_t aSize,
                              ipc::Shmem::SharedMemory::SharedMemoryType aType,
                              ipc::Shmem* aMem);
-  virtual bool MgrDeallocShmem(GMPSharedMem::GMPMemoryClasses aClass, ipc::Shmem& aMem);
+  virtual bool MgrDeallocShmem(GMPSharedMem::GMPMemoryClasses aClass,
+                               ipc::Shmem& aMem);
 
-  // So we can know if data is "piling up" for the plugin - I.e. it's hung or crashed
+  // So we can know if data is "piling up" for the plugin - I.e. it's hung or
+  // crashed
   virtual uint32_t NumInUse(GMPSharedMem::GMPMemoryClasses aClass);
 
-  // These have to be implemented using the AllocShmem/etc provided by the IPDL-generated interfaces,
-  // so have the Parent/Child implement them.
-  virtual bool Alloc(size_t aSize, ipc::Shmem::SharedMemory::SharedMemoryType aType, ipc::Shmem* aMem) = 0;
+  // These have to be implemented using the AllocShmem/etc provided by the
+  // IPDL-generated interfaces, so have the Parent/Child implement them.
+  virtual bool Alloc(size_t aSize,
+                     ipc::Shmem::SharedMemory::SharedMemoryType aType,
+                     ipc::Shmem* aMem) = 0;
   virtual void Dealloc(ipc::Shmem& aMem) = 0;
 
 private:
   nsTArray<ipc::Shmem>& GetGmpFreelist(GMPSharedMem::GMPMemoryClasses aTypes)
   {
     return mData->mGmpFreelist[aTypes];
   }
 
--- a/dom/media/gmp/GMPStorage.h
+++ b/dom/media/gmp/GMPStorage.h
@@ -10,29 +10,30 @@
 #include "mozilla/AlreadyAddRefed.h"
 #include "nsISupportsImpl.h"
 #include "nsString.h"
 #include "nsTArray.h"
 
 namespace mozilla {
 namespace gmp {
 
-class GMPStorage {
+class GMPStorage
+{
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPStorage)
 
   virtual GMPErr Open(const nsCString& aRecordName) = 0;
   virtual bool IsOpen(const nsCString& aRecordName) const = 0;
   virtual GMPErr Read(const nsCString& aRecordName,
                       nsTArray<uint8_t>& aOutBytes) = 0;
   virtual GMPErr Write(const nsCString& aRecordName,
                        const nsTArray<uint8_t>& aBytes) = 0;
   virtual void Close(const nsCString& aRecordName) = 0;
 protected:
-  virtual ~GMPStorage() {}
+  virtual ~GMPStorage() { }
 };
 
 already_AddRefed<GMPStorage> CreateGMPMemoryStorage();
 already_AddRefed<GMPStorage> CreateGMPDiskStorage(const nsCString& aNodeId,
                                                   const nsString& aGMPName);
 
 } // namespace gmp
 } // namespace mozilla
--- a/dom/media/gmp/GMPStorageChild.cpp
+++ b/dom/media/gmp/GMPStorageChild.cpp
@@ -1,30 +1,30 @@
 /* -*- 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/. */
 
 #include "GMPStorageChild.h"
 #include "GMPChild.h"
+#include "base/task.h"
 #include "gmp-storage.h"
-#include "base/task.h"
 
 #define ON_GMP_THREAD() (mPlugin->GMPMessageLoop() == MessageLoop::current())
 
-#define CALL_ON_GMP_THREAD(_func, ...) \
-  do { \
-    if (ON_GMP_THREAD()) { \
-      _func(__VA_ARGS__); \
-    } else { \
-      mPlugin->GMPMessageLoop()->PostTask( \
-        dont_add_new_uses_of_this::NewRunnableMethod(this, &GMPStorageChild::_func, ##__VA_ARGS__) \
-      ); \
-    } \
-  } while(false)
+#define CALL_ON_GMP_THREAD(_func, ...)                                         \
+  do {                                                                         \
+    if (ON_GMP_THREAD()) {                                                     \
+      _func(__VA_ARGS__);                                                      \
+    } else {                                                                   \
+      mPlugin->GMPMessageLoop()->PostTask(                                     \
+        dont_add_new_uses_of_this::NewRunnableMethod(                          \
+          this, &GMPStorageChild::_func, ##__VA_ARGS__));                      \
+    }                                                                          \
+  } while (false)
 
 static nsTArray<uint8_t>
 ToArray(const uint8_t* aData, uint32_t aDataSize)
 {
   nsTArray<uint8_t> data;
   data.AppendElements(aData, aDataSize);
   return mozilla::Move(data);
 }
--- a/dom/media/gmp/GMPStorageChild.h
+++ b/dom/media/gmp/GMPStorageChild.h
@@ -1,21 +1,21 @@
 /* -*- 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 GMPStorageChild_h_
 #define GMPStorageChild_h_
 
+#include "gmp-platform.h"
+#include "gmp-storage.h"
 #include "mozilla/gmp/PGMPStorageChild.h"
-#include "gmp-storage.h"
+#include "nsRefPtrHashtable.h"
 #include "nsTHashtable.h"
-#include "nsRefPtrHashtable.h"
-#include "gmp-platform.h"
 
 #include <queue>
 
 namespace mozilla {
 namespace gmp {
 
 class GMPChild;
 class GMPStorageChild;
@@ -38,17 +38,17 @@ public:
 
   const nsCString& Name() const { return mName; }
 
   void OpenComplete(GMPErr aStatus);
   void ReadComplete(GMPErr aStatus, const uint8_t* aBytes, uint32_t aLength);
   void WriteComplete(GMPErr aStatus);
 
 private:
-  ~GMPRecordImpl() {}
+  ~GMPRecordImpl() { }
   const nsCString mName;
   GMPRecordClient* const mClient;
   GMPStorageChild* const mOwner;
 };
 
 class GMPStorageChild : public PGMPStorageChild
 {
 public:
@@ -75,19 +75,20 @@ private:
   already_AddRefed<GMPRecordImpl> GetRecord(const nsCString& aRecordName);
 
 protected:
   ~GMPStorageChild() {}
 
   // PGMPStorageChild
   mozilla::ipc::IPCResult RecvOpenComplete(const nsCString& aRecordName,
                                            const GMPErr& aStatus) override;
-  mozilla::ipc::IPCResult RecvReadComplete(const nsCString& aRecordName,
-                                           const GMPErr& aStatus,
-                                           InfallibleTArray<uint8_t>&& aBytes) override;
+  mozilla::ipc::IPCResult RecvReadComplete(
+    const nsCString& aRecordName,
+    const GMPErr& aStatus,
+    InfallibleTArray<uint8_t>&& aBytes) override;
   mozilla::ipc::IPCResult RecvWriteComplete(const nsCString& aRecordName,
                                             const GMPErr& aStatus) override;
   mozilla::ipc::IPCResult RecvShutdown() override;
 
 private:
   Monitor mMonitor;
   nsRefPtrHashtable<nsCStringHashKey, GMPRecordImpl> mRecords;
   GMPChild* mPlugin;
--- a/dom/media/gmp/GMPStorageParent.cpp
+++ b/dom/media/gmp/GMPStorageParent.cpp
@@ -1,18 +1,18 @@
 /* -*- 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/. */
 
 #include "GMPStorageParent.h"
 #include "GMPParent.h"
 #include "gmp-storage.h"
+#include "mozIGeckoMediaPluginService.h"
 #include "mozilla/Unused.h"
-#include "mozIGeckoMediaPluginService.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
 extern LogModule* GetGMPLog();
@@ -33,23 +33,25 @@ GMPStorageParent::GMPStorageParent(const
 nsresult
 GMPStorageParent::Init()
 {
   LOGD(("GMPStorageParent[%p]::Init()", this));
 
   if (NS_WARN_IF(mNodeId.IsEmpty())) {
     return NS_ERROR_FAILURE;
   }
-  RefPtr<GeckoMediaPluginServiceParent> mps(GeckoMediaPluginServiceParent::GetSingleton());
+  RefPtr<GeckoMediaPluginServiceParent> mps(
+    GeckoMediaPluginServiceParent::GetSingleton());
   if (NS_WARN_IF(!mps)) {
     return NS_ERROR_FAILURE;
   }
 
   bool persistent = false;
-  if (NS_WARN_IF(NS_FAILED(mps->IsPersistentStorageAllowed(mNodeId, &persistent)))) {
+  if (NS_WARN_IF(
+        NS_FAILED(mps->IsPersistentStorageAllowed(mNodeId, &persistent)))) {
     return NS_ERROR_FAILURE;
   }
   if (persistent) {
     mStorage = CreateGMPDiskStorage(mNodeId, mPlugin->GetPluginBaseName());
   } else {
     mStorage = mps->GetMemoryStorageFor(mNodeId);
   }
   if (!mStorage) {
@@ -75,18 +77,20 @@ GMPStorageParent::RecvOpen(const nsCStri
     // or shared across origin.
     LOGD(("GMPStorageParent[%p]::RecvOpen(record='%s') failed; null nodeId",
           this, aRecordName.get()));
     Unused << SendOpenComplete(aRecordName, GMPGenericErr);
     return IPC_OK();
   }
 
   if (aRecordName.IsEmpty()) {
-    LOGD(("GMPStorageParent[%p]::RecvOpen(record='%s') failed; record name empty",
-          this, aRecordName.get()));
+    LOGD(
+      ("GMPStorageParent[%p]::RecvOpen(record='%s') failed; record name empty",
+       this,
+       aRecordName.get()));
     Unused << SendOpenComplete(aRecordName, GMPGenericErr);
     return IPC_OK();
   }
 
   if (mStorage->IsOpen(aRecordName)) {
     LOGD(("GMPStorageParent[%p]::RecvOpen(record='%s') failed; record in use",
           this, aRecordName.get()));
     Unused << SendOpenComplete(aRecordName, GMPRecordInUse);
--- a/dom/media/gmp/GMPStorageParent.h
+++ b/dom/media/gmp/GMPStorageParent.h
@@ -1,43 +1,45 @@
 /* -*- 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 GMPStorageParent_h_
 #define GMPStorageParent_h_
 
+#include "GMPStorage.h"
 #include "mozilla/gmp/PGMPStorageParent.h"
-#include "GMPStorage.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPParent;
 
-class GMPStorageParent : public PGMPStorageParent {
+class GMPStorageParent : public PGMPStorageParent
+{
 public:
   NS_INLINE_DECL_REFCOUNTING(GMPStorageParent)
   GMPStorageParent(const nsCString& aNodeId,
                    GMPParent* aPlugin);
 
   nsresult Init();
   void Shutdown();
 
 protected:
   mozilla::ipc::IPCResult RecvOpen(const nsCString& aRecordName) override;
   mozilla::ipc::IPCResult RecvRead(const nsCString& aRecordName) override;
-  mozilla::ipc::IPCResult RecvWrite(const nsCString& aRecordName,
-                                    InfallibleTArray<uint8_t>&& aBytes) override;
+  mozilla::ipc::IPCResult RecvWrite(
+    const nsCString& aRecordName,
+    InfallibleTArray<uint8_t>&& aBytes) override;
   mozilla::ipc::IPCResult RecvClose(const nsCString& aRecordName) override;
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
 private:
-  ~GMPStorageParent() {}
+  ~GMPStorageParent() { }
 
   RefPtr<GMPStorage> mStorage;
 
   const nsCString mNodeId;
   RefPtr<GMPParent> mPlugin;
   // True after Shutdown(), or if Init() has not completed successfully.
   bool mShutdown;
 };
--- a/dom/media/gmp/GMPTimerChild.cpp
+++ b/dom/media/gmp/GMPTimerChild.cpp
@@ -1,16 +1,16 @@
 /* -*- 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/. */
 
 #include "GMPTimerChild.h"
+#include "GMPChild.h"
 #include "GMPPlatform.h"
-#include "GMPChild.h"
 
 #define MAX_NUM_TIMERS 1000
 
 namespace mozilla {
 namespace gmp {
 
 GMPTimerChild::GMPTimerChild(GMPChild* aPlugin)
   : mTimerCount(1)
--- a/dom/media/gmp/GMPTimerChild.h
+++ b/dom/media/gmp/GMPTimerChild.h
@@ -1,22 +1,22 @@
 /* -*- 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 GMPTimerChild_h_
 #define GMPTimerChild_h_
 
+#include "gmp-errors.h"
+#include "gmp-platform.h"
+#include "mozilla/Monitor.h"
 #include "mozilla/gmp/PGMPTimerChild.h"
-#include "mozilla/Monitor.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
-#include "gmp-errors.h"
-#include "gmp-platform.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPChild;
 
 class GMPTimerChild : public PGMPTimerChild
 {
--- a/dom/media/gmp/GMPTimerParent.h
+++ b/dom/media/gmp/GMPTimerParent.h
@@ -1,28 +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 GMPTimerParent_h_
 #define GMPTimerParent_h_
 
+#include "mozilla/Monitor.h"
 #include "mozilla/gmp/PGMPTimerParent.h"
-#include "nsITimer.h"
 #include "nsCOMPtr.h"
 #include "nsClassHashtable.h"
 #include "nsHashKeys.h"
-#include "mozilla/Monitor.h"
 #include "nsIThread.h"
+#include "nsITimer.h"
 
 namespace mozilla {
 namespace gmp {
 
-class GMPTimerParent : public PGMPTimerParent {
+class GMPTimerParent : public PGMPTimerParent
+{
 public:
   NS_INLINE_DECL_REFCOUNTING(GMPTimerParent)
   explicit GMPTimerParent(nsIThread* aGMPThread);
 
   void Shutdown();
 
 protected:
   mozilla::ipc::IPCResult RecvSetTimer(const uint32_t& aTimerId,
@@ -37,17 +38,18 @@ private:
   struct Context {
     Context() {
       MOZ_COUNT_CTOR(Context);
     }
     ~Context() {
       MOZ_COUNT_DTOR(Context);
     }
     nsCOMPtr<nsITimer> mTimer;
-    RefPtr<GMPTimerParent> mParent; // Note: live timers keep the GMPTimerParent alive.
+    // Note: live timers keep the GMPTimerParent alive.
+    RefPtr<GMPTimerParent> mParent;
     uint32_t mId;
   };
 
   void TimerExpired(Context* aContext);
 
   nsTHashtable<nsPtrHashKey<Context>> mTimers;
 
   nsCOMPtr<nsIThread> mGMPThread;
--- a/dom/media/gmp/GMPTypes.ipdlh
+++ b/dom/media/gmp/GMPTypes.ipdlh
@@ -4,17 +4,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 using GMPBufferType from "gmp-video-codec.h";
 using GMPMediaKeyStatus from "gmp-decryption.h";
 
 namespace mozilla {
 namespace gmp {
 
-struct GMPDecryptionData {
+struct GMPDecryptionData
+{
   uint8_t[] mKeyId;
   uint8_t[] mIV;
   uint16_t[] mClearBytes;
   uint32_t[] mCipherBytes;
   nsCString[] mSessionIds;
 };
 
 struct GMPVideoEncodedFrameData
@@ -44,15 +45,16 @@ struct GMPVideoi420FrameData
   GMPPlaneData mUPlane;
   GMPPlaneData mVPlane;
   int32_t mWidth;
   int32_t mHeight;
   uint64_t mTimestamp; // microseconds
   uint64_t mDuration; // microseconds
 };
 
-struct GMPKeyInformation {
+struct GMPKeyInformation
+{
   uint8_t[] keyId;
   GMPMediaKeyStatus status;
 };
 
 }
 }
--- a/dom/media/gmp/GMPUtils.cpp
+++ b/dom/media/gmp/GMPUtils.cpp
@@ -174,24 +174,26 @@ GMPInfoFileParser::Init(nsIFile* aInfoFi
     value->Trim(" ");
     mValues.Put(key, value); // Hashtable assumes ownership of value.
   }
 
   return true;
 }
 
 bool
-GMPInfoFileParser::Contains(const nsCString& aKey) const {
+GMPInfoFileParser::Contains(const nsCString& aKey) const
+{
   nsCString key(aKey);
   ToLowerCase(key);
   return mValues.Contains(key);
 }
 
 nsCString
-GMPInfoFileParser::Get(const nsCString& aKey) const {
+GMPInfoFileParser::Get(const nsCString& aKey) const
+{
   MOZ_ASSERT(Contains(aKey));
   nsCString key(aKey);
   ToLowerCase(key);
   nsCString* p = nullptr;
   if (mValues.Get(key, &p)) {
     return nsCString(*p);
   }
   return EmptyCString();
--- a/dom/media/gmp/GMPUtils.h
+++ b/dom/media/gmp/GMPUtils.h
@@ -2,82 +2,77 @@
 /* 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 GMPUtils_h_
 #define GMPUtils_h_
 
 #include "mozilla/UniquePtr.h"
-#include "nsTArray.h"
 #include "nsCOMPtr.h"
 #include "nsClassHashtable.h"
+#include "nsTArray.h"
 
 class nsIFile;
 class nsCString;
 class nsISimpleEnumerator;
 
 namespace mozilla {
 
 template<typename T>
 struct DestroyPolicy
 {
-  void operator()(T* aGMPObject) const {
+  void operator()(T* aGMPObject) const
+  {
     aGMPObject->Destroy();
   }
 };
 
 template<typename T>
 using GMPUniquePtr = mozilla::UniquePtr<T, DestroyPolicy<T>>;
 
-void
-SplitAt(const char* aDelims,
-        const nsACString& aInput,
-        nsTArray<nsCString>& aOutTokens);
+void SplitAt(const char* aDelims,
+             const nsACString& aInput,
+             nsTArray<nsCString>& aOutTokens);
 
-nsCString
-ToHexString(const nsTArray<uint8_t>& aBytes);
+nsCString ToHexString(const nsTArray<uint8_t>& aBytes);
 
-nsCString
-ToHexString(const uint8_t* aBytes, uint32_t aLength);
+nsCString ToHexString(const uint8_t* aBytes, uint32_t aLength);
 
-bool
-FileExists(nsIFile* aFile);
+bool FileExists(nsIFile* aFile);
 
 // Enumerate directory entries for a specified path.
-class DirectoryEnumerator {
+class DirectoryEnumerator
+{
 public:
 
-  enum Mode {
+  enum Mode
+  {
     DirsOnly, // Enumeration only includes directories.
     FilesAndDirs // Enumeration includes directories and non-directory files.
   };
 
   DirectoryEnumerator(nsIFile* aPath, Mode aMode);
 
   already_AddRefed<nsIFile> Next();
 
 private:
   Mode mMode;
   nsCOMPtr<nsISimpleEnumerator> mIter;
 };
 
-class GMPInfoFileParser {
+class GMPInfoFileParser
+{
 public:
   bool Init(nsIFile* aFile);
   bool Contains(const nsCString& aKey) const;
   nsCString Get(const nsCString& aKey) const;
 private:
   nsClassHashtable<nsCStringHashKey, nsCString> mValues;
 };
 
-bool
-ReadIntoString(nsIFile* aFile,
-               nsCString& aOutDst,
-               size_t aMaxLength);
+bool ReadIntoString(nsIFile* aFile, nsCString& aOutDst, size_t aMaxLength);
 
-bool
-HaveGMPFor(const nsCString& aAPI,
-           nsTArray<nsCString>&& aTags);
+bool HaveGMPFor(const nsCString& aAPI, nsTArray<nsCString>&& aTags);
 
 } // namespace mozilla
 
 #endif
--- a/dom/media/gmp/GMPVideoDecoderChild.cpp
+++ b/dom/media/gmp/GMPVideoDecoderChild.cpp
@@ -1,20 +1,20 @@
 /* -*- 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/. */
 
 #include "GMPVideoDecoderChild.h"
+#include "GMPContentChild.h"
+#include "GMPVideoEncodedFrameImpl.h"
 #include "GMPVideoi420FrameImpl.h"
-#include "GMPContentChild.h"
+#include "mozilla/Unused.h"
+#include "runnable_utils.h"
 #include <stdio.h>
-#include "mozilla/Unused.h"
-#include "GMPVideoEncodedFrameImpl.h"
-#include "runnable_utils.h"
 
 namespace mozilla {
 namespace gmp {
 
 GMPVideoDecoderChild::GMPVideoDecoderChild(GMPContentChild* aPlugin)
   : GMPSharedMemManager(aPlugin)
   , mPlugin(aPlugin)
   , mVideoDecoder(nullptr)
@@ -28,17 +28,18 @@ GMPVideoDecoderChild::GMPVideoDecoderChi
 GMPVideoDecoderChild::~GMPVideoDecoderChild()
 {
   MOZ_ASSERT(!mNeedShmemIntrCount);
 }
 
 void
 GMPVideoDecoderChild::Init(GMPVideoDecoder* aDecoder)
 {
-  MOZ_ASSERT(aDecoder, "Cannot initialize video decoder child without a video decoder!");
+  MOZ_ASSERT(aDecoder,
+             "Cannot initialize video decoder child without a video decoder!");
   mVideoDecoder = aDecoder;
 }
 
 GMPVideoHostImpl&
 GMPVideoDecoderChild::Host()
 {
   return mVideoHost;
 }
@@ -113,17 +114,18 @@ mozilla::ipc::IPCResult
 GMPVideoDecoderChild::RecvInitDecode(const GMPVideoCodec& aCodecSettings,
                                      InfallibleTArray<uint8_t>&& aCodecSpecific,
                                      const int32_t& aCoreCount)
 {
   if (!mVideoDecoder) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mVideoDecoder->InitDecode(aCodecSettings,
                             aCodecSpecific.Elements(),
                             aCodecSpecific.Length(),
                             this,
                             aCoreCount);
   return IPC_OK();
 }
 
@@ -134,17 +136,18 @@ GMPVideoDecoderChild::RecvDecode(const G
                                  const int64_t& aRenderTimeMs)
 {
   if (!mVideoDecoder) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   auto f = new GMPVideoEncodedFrameImpl(aInputFrame, &mVideoHost);
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mVideoDecoder->Decode(f,
                         aMissingFrames,
                         aCodecSpecificInfo.Elements(),
                         aCodecSpecificInfo.Length(),
                         aRenderTimeMs);
 
   return IPC_OK();
 }
@@ -161,30 +164,32 @@ GMPVideoDecoderChild::RecvChildShmemForP
 
 mozilla::ipc::IPCResult
 GMPVideoDecoderChild::RecvReset()
 {
   if (!mVideoDecoder) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mVideoDecoder->Reset();
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoDecoderChild::RecvDrain()
 {
   if (!mVideoDecoder) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mVideoDecoder->Drain();
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoDecoderChild::RecvDecodingComplete()
 {
@@ -194,17 +199,18 @@ GMPVideoDecoderChild::RecvDecodingComple
     // There's a GMP blocked in Alloc() waiting for the CallNeedShem() to
     // return a frame they can use. Don't call the GMP's DecodingComplete()
     // now and don't delete the GMPVideoDecoderChild, defer processing the
     // DecodingComplete() until once the Alloc() finishes.
     mPendingDecodeComplete = true;
     return IPC_OK();
   }
   if (mVideoDecoder) {
-    // Ignore any return code. It is OK for this to fail without killing the process.
+    // Ignore any return code. It is OK for this to fail without killing the
+    // process.
     mVideoDecoder->DecodingComplete();
     mVideoDecoder = nullptr;
   }
 
   mVideoHost.DoneWithAPI();
 
   mPlugin = nullptr;
 
--- a/dom/media/gmp/GMPVideoDecoderChild.h
+++ b/dom/media/gmp/GMPVideoDecoderChild.h
@@ -35,30 +35,34 @@ public:
   void ReceivedDecodedReferenceFrame(const uint64_t pictureId) override;
   void ReceivedDecodedFrame(const uint64_t pictureId) override;
   void InputDataExhausted() override;
   void DrainComplete() override;
   void ResetComplete() override;
   void Error(GMPErr aError) override;
 
   // GMPSharedMemManager
-  bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) override;
+  bool Alloc(size_t aSize,
+             Shmem::SharedMemory::SharedMemoryType aType,
+             Shmem* aMem) override;
   void Dealloc(Shmem& aMem) override;
 
 private:
   virtual ~GMPVideoDecoderChild();
 
   // PGMPVideoDecoderChild
-  mozilla::ipc::IPCResult RecvInitDecode(const GMPVideoCodec& aCodecSettings,
-                                         InfallibleTArray<uint8_t>&& aCodecSpecific,
-                                         const int32_t& aCoreCount) override;
-  mozilla::ipc::IPCResult RecvDecode(const GMPVideoEncodedFrameData& aInputFrame,
-                                     const bool& aMissingFrames,
-                                     InfallibleTArray<uint8_t>&& aCodecSpecificInfo,
-                                     const int64_t& aRenderTimeMs) override;
+  mozilla::ipc::IPCResult RecvInitDecode(
+    const GMPVideoCodec& aCodecSettings,
+    InfallibleTArray<uint8_t>&& aCodecSpecific,
+    const int32_t& aCoreCount) override;
+  mozilla::ipc::IPCResult RecvDecode(
+    const GMPVideoEncodedFrameData& aInputFrame,
+    const bool& aMissingFrames,
+    InfallibleTArray<uint8_t>&& aCodecSpecificInfo,
+    const int64_t& aRenderTimeMs) override;
   mozilla::ipc::IPCResult RecvChildShmemForPool(Shmem&& aFrameBuffer) override;
   mozilla::ipc::IPCResult RecvReset() override;
   mozilla::ipc::IPCResult RecvDrain() override;
   mozilla::ipc::IPCResult RecvDecodingComplete() override;
 
   GMPContentChild* mPlugin;
   GMPVideoDecoder* mVideoDecoder;
   GMPVideoHostImpl mVideoHost;
--- a/dom/media/gmp/GMPVideoDecoderParent.cpp
+++ b/dom/media/gmp/GMPVideoDecoderParent.cpp
@@ -1,24 +1,24 @@
 /* -*- 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/. */
 
 #include "GMPVideoDecoderParent.h"
-#include "mozilla/Logging.h"
-#include "mozilla/Unused.h"
-#include "nsAutoRef.h"
-#include "nsThreadUtils.h"
+#include "GMPContentParent.h"
+#include "GMPMessageUtils.h"
 #include "GMPUtils.h"
 #include "GMPVideoEncodedFrameImpl.h"
 #include "GMPVideoi420FrameImpl.h"
-#include "GMPContentParent.h"
-#include "GMPMessageUtils.h"
+#include "mozilla/Logging.h"
+#include "mozilla/Unused.h"
 #include "mozilla/gmp/GMPTypes.h"
+#include "nsAutoRef.h"
+#include "nsThreadUtils.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
 extern LogModule* GetGMPLog();
@@ -51,19 +51,17 @@ GMPVideoDecoderParent::GMPVideoDecoderPa
   , mCallback(nullptr)
   , mVideoHost(this)
   , mPluginId(aPlugin->GetPluginId())
   , mFrameCount(0)
 {
   MOZ_ASSERT(mPlugin);
 }
 
-GMPVideoDecoderParent::~GMPVideoDecoderParent()
-{
-}
+GMPVideoDecoderParent::~GMPVideoDecoderParent() { }
 
 GMPVideoHostImpl&
 GMPVideoDecoderParent::Host()
 {
   return mVideoHost;
 }
 
 // Note: may be called via Terminated()
@@ -124,60 +122,66 @@ GMPVideoDecoderParent::InitDecode(const 
 
 static nsCString
 CryptoInfo(const GMPUniquePtr<GMPVideoEncodedFrame>& aInputFrame)
 {
   const GMPEncryptedBufferMetadata* crypto = aInputFrame->GetDecryptionData();
   if (!crypto) {
     return EmptyCString();
   }
-  return nsPrintfCString(" kid=%s",
-                         ToHexString(crypto->KeyId(), crypto->KeyIdSize()).get());
+  return nsPrintfCString(
+    " kid=%s", ToHexString(crypto->KeyId(), crypto->KeyIdSize()).get());
 }
 
 nsresult
 GMPVideoDecoderParent::Decode(GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
                               bool aMissingFrames,
                               const nsTArray<uint8_t>& aCodecSpecificInfo,
                               int64_t aRenderTimeMs)
 {
   LOGV(("GMPVideoDecoderParent[%p]::Decode() timestamp=%lld keyframe=%d%s",
         this, aInputFrame->TimeStamp(),
         aInputFrame->FrameType() == kGMPKeyFrame,
         CryptoInfo(aInputFrame).get()));
 
   if (!mIsOpen) {
-    LOGE(("GMPVideoDecoderParent[%p]::Decode() ERROR; dead GMPVideoDecoder", this));
+    LOGE(("GMPVideoDecoderParent[%p]::Decode() ERROR; dead GMPVideoDecoder",
+          this));
     NS_WARNING("Trying to use an dead GMP video decoder");
     return NS_ERROR_FAILURE;
   }
 
   MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
 
   GMPUniquePtr<GMPVideoEncodedFrameImpl> inputFrameImpl(
     static_cast<GMPVideoEncodedFrameImpl*>(aInputFrame.release()));
 
   // Very rough kill-switch if the plugin stops processing.  If it's merely
   // hung and continues, we'll come back to life eventually.
   // 3* is because we're using 3 buffers per frame for i420 data for now.
-  if ((NumInUse(GMPSharedMem::kGMPFrameData) > 3*GMPSharedMem::kGMPBufLimit) ||
-      (NumInUse(GMPSharedMem::kGMPEncodedData) > GMPSharedMem::kGMPBufLimit)) {
-    LOGE(("GMPVideoDecoderParent[%p]::Decode() ERROR; shmem buffer limit hit frame=%d encoded=%d",
-          this, NumInUse(GMPSharedMem::kGMPFrameData), NumInUse(GMPSharedMem::kGMPEncodedData)));
+  if ((NumInUse(GMPSharedMem::kGMPFrameData) > 3*GMPSharedMem::kGMPBufLimit)
+      || (NumInUse(GMPSharedMem::kGMPEncodedData)
+          > GMPSharedMem::kGMPBufLimit)) {
+    LOGE(("GMPVideoDecoderParent[%p]::Decode() ERROR; shmem buffer limit hit "
+          "frame=%d encoded=%d",
+          this,
+          NumInUse(GMPSharedMem::kGMPFrameData),
+          NumInUse(GMPSharedMem::kGMPEncodedData)));
     return NS_ERROR_FAILURE;
   }
 
   GMPVideoEncodedFrameData frameData;
   inputFrameImpl->RelinquishFrameData(frameData);
 
   if (!SendDecode(frameData,
                   aMissingFrames,
                   aCodecSpecificInfo,
                   aRenderTimeMs)) {
-    LOGE(("GMPVideoDecoderParent[%p]::Decode() ERROR; SendDecode() failure.", this));
+    LOGE(("GMPVideoDecoderParent[%p]::Decode() ERROR; SendDecode() failure.",
+          this));
     return NS_ERROR_FAILURE;
   }
   mFrameCount++;
 
   // Async IPC, we don't have access to a return value.
   return NS_OK;
 }
 
@@ -195,21 +199,23 @@ GMPVideoDecoderParent::Reset()
 
   if (!SendReset()) {
     return NS_ERROR_FAILURE;
   }
 
   mIsAwaitingResetComplete = true;
 
   RefPtr<GMPVideoDecoderParent> self(this);
-  nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([self]() -> void
-  {
-    LOGD(("GMPVideoDecoderParent[%p]::ResetCompleteTimeout() timed out waiting for ResetComplete", self.get()));
+  nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([self]() -> void {
+    LOGD(("GMPVideoDecoderParent[%p]::ResetCompleteTimeout() timed out waiting "
+          "for ResetComplete",
+          self.get()));
     self->mResetCompleteTimeout = nullptr;
-    LogToBrowserConsole(NS_LITERAL_STRING("GMPVideoDecoderParent timed out waiting for ResetComplete()"));
+    LogToBrowserConsole(NS_LITERAL_STRING(
+      "GMPVideoDecoderParent timed out waiting for ResetComplete()"));
   });
   CancelResetCompleteTimeout();
   mResetCompleteTimeout = SimpleTimer::Create(task, 5000, mPlugin->GMPThread());
 
   // Async IPC, we don't have access to a return value.
   return NS_OK;
 }
 
@@ -328,67 +334,74 @@ GMPVideoDecoderParent::RecvDecoded(const
 
   if (!GMPVideoi420FrameImpl::CheckFrameData(aDecodedFrame)) {
     LOGE(("GMPVideoDecoderParent[%p]::RecvDecoded() "
        "timestamp=%lld decoded frame corrupt, ignoring"));
     return IPC_FAIL_NO_REASON(this);
   }
   auto f = new GMPVideoi420FrameImpl(aDecodedFrame, &mVideoHost);
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mCallback->Decoded(f);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-GMPVideoDecoderParent::RecvReceivedDecodedReferenceFrame(const uint64_t& aPictureId)
+GMPVideoDecoderParent::RecvReceivedDecodedReferenceFrame(
+  const uint64_t& aPictureId)
 {
   if (!mCallback) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mCallback->ReceivedDecodedReferenceFrame(aPictureId);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoDecoderParent::RecvReceivedDecodedFrame(const uint64_t& aPictureId)
 {
   if (!mCallback) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mCallback->ReceivedDecodedFrame(aPictureId);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoDecoderParent::RecvInputDataExhausted()
 {
   LOGV(("GMPVideoDecoderParent[%p]::RecvInputDataExhausted()", this));
 
   if (!mCallback) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mCallback->InputDataExhausted();
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoDecoderParent::RecvDrainComplete()
 {
-  LOGD(("GMPVideoDecoderParent[%p]::RecvDrainComplete() frameCount=%d", this, mFrameCount));
+  LOGD(("GMPVideoDecoderParent[%p]::RecvDrainComplete() frameCount=%d",
+        this,
+        mFrameCount));
   nsAutoString msg;
   msg.AppendLiteral("GMPVideoDecoderParent::RecvDrainComplete() outstanding frames=");
   msg.AppendInt(mFrameCount);
   LogToBrowserConsole(msg);
 
   if (!mCallback) {
     // We anticipate shutting down in the middle of a drain in the
     // `UnblockResetAndDrain` method, which is called when we shutdown, so
@@ -422,17 +435,18 @@ GMPVideoDecoderParent::RecvResetComplete
   }
 
   if (!mIsAwaitingResetComplete) {
     return IPC_OK();
   }
   mIsAwaitingResetComplete = false;
   mFrameCount = 0;
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mCallback->ResetComplete();
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoDecoderParent::RecvError(const GMPErr& aError)
 {
@@ -442,17 +456,18 @@ GMPVideoDecoderParent::RecvError(const G
     return IPC_FAIL_NO_REASON(this);
   }
 
   // Ensure if we've received an error while waiting for a ResetComplete
   // or DrainComplete notification, we'll unblock the caller before processing
   // the error.
   UnblockResetAndDrain();
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mCallback->Error(aError);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoDecoderParent::RecvShutdown()
 {
@@ -475,34 +490,35 @@ GMPVideoDecoderParent::RecvParentShmemFo
 mozilla::ipc::IPCResult
 GMPVideoDecoderParent::AnswerNeedShmem(const uint32_t& aFrameBufferSize,
                                        Shmem* aMem)
 {
   ipc::Shmem mem;
 
   if (!mVideoHost.SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPFrameData,
                                                 aFrameBufferSize,
-                                                ipc::SharedMemory::TYPE_BASIC, &mem))
-  {
+                                                ipc::SharedMemory::TYPE_BASIC,
+                                                &mem)) {
     LOGE(("%s: Failed to get a shared mem buffer for Child! size %u",
          __FUNCTION__, aFrameBufferSize));
     return IPC_FAIL_NO_REASON(this);
   }
   *aMem = mem;
   mem = ipc::Shmem();
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoDecoderParent::Recv__delete__()
 {
   LOGD(("GMPVideoDecoderParent[%p]::Recv__delete__()", this));
 
   if (mPlugin) {
-    // Ignore any return code. It is OK for this to fail without killing the process.
+    // Ignore any return code. It is OK for this to fail without killing the
+    // process.
     mPlugin->VideoDecoderDestroyed(this);
     mPlugin = nullptr;
   }
 
   return IPC_OK();
 }
 
 void
--- a/dom/media/gmp/GMPVideoDecoderParent.h
+++ b/dom/media/gmp/GMPVideoDecoderParent.h
@@ -1,26 +1,26 @@
 /* -*- 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 GMPVideoDecoderParent_h_
 #define GMPVideoDecoderParent_h_
 
-#include "mozilla/RefPtr.h"
-#include "gmp-video-decode.h"
-#include "mozilla/gmp/PGMPVideoDecoderParent.h"
+#include "GMPCrashHelperHolder.h"
 #include "GMPMessageUtils.h"
 #include "GMPSharedMemManager.h"
 #include "GMPUtils.h"
+#include "GMPVideoDecoderProxy.h"
 #include "GMPVideoHost.h"
-#include "GMPVideoDecoderProxy.h"
 #include "VideoUtils.h"
-#include "GMPCrashHelperHolder.h"
+#include "gmp-video-decode.h"
+#include "mozilla/RefPtr.h"
+#include "mozilla/gmp/PGMPVideoDecoderParent.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPContentParent;
 
 class GMPVideoDecoderParent final : public PGMPVideoDecoderParent
                                   , public GMPVideoDecoderProxy
@@ -46,17 +46,19 @@ public:
                   const nsTArray<uint8_t>& aCodecSpecificInfo,
                   int64_t aRenderTimeMs = -1) override;
   nsresult Reset() override;
   nsresult Drain() override;
   uint32_t GetPluginId() const override { return mPluginId; }
   const nsCString& GetDisplayName() const override;
 
   // GMPSharedMemManager
-  bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) override
+  bool Alloc(size_t aSize,
+             Shmem::SharedMemory::SharedMemoryType aType,
+             Shmem* aMem) override
   {
 #ifdef GMP_SAFE_SHMEM
     return AllocShmem(aSize, aType, aMem);
 #else
     return AllocUnsafeShmem(aSize, aType, aMem);
 #endif
   }
   void Dealloc(Shmem& aMem) override
@@ -64,25 +66,29 @@ public:
     DeallocShmem(aMem);
   }
 
 private:
   ~GMPVideoDecoderParent();
 
   // PGMPVideoDecoderParent
   void ActorDestroy(ActorDestroyReason aWhy) override;
-  mozilla::ipc::IPCResult RecvDecoded(const GMPVideoi420FrameData& aDecodedFrame) override;
-  mozilla::ipc::IPCResult RecvReceivedDecodedReferenceFrame(const uint64_t& aPictureId) override;
-  mozilla::ipc::IPCResult RecvReceivedDecodedFrame(const uint64_t& aPictureId) override;
+  mozilla::ipc::IPCResult RecvDecoded(
+    const GMPVideoi420FrameData& aDecodedFrame) override;
+  mozilla::ipc::IPCResult RecvReceivedDecodedReferenceFrame(
+    const uint64_t& aPictureId) override;
+  mozilla::ipc::IPCResult RecvReceivedDecodedFrame(
+    const uint64_t& aPictureId) override;
   mozilla::ipc::IPCResult RecvInputDataExhausted() override;
   mozilla::ipc::IPCResult RecvDrainComplete() override;
   mozilla::ipc::IPCResult RecvResetComplete() override;
   mozilla::ipc::IPCResult RecvError(const GMPErr& aError) override;
   mozilla::ipc::IPCResult RecvShutdown() override;
-  mozilla::ipc::IPCResult RecvParentShmemForPool(Shmem&& aEncodedBuffer) override;
+  mozilla::ipc::IPCResult RecvParentShmemForPool(
+    Shmem&& aEncodedBuffer) override;
   mozilla::ipc::IPCResult AnswerNeedShmem(const uint32_t& aFrameBufferSize,
                                           Shmem* aMem) override;
   mozilla::ipc::IPCResult Recv__delete__() override;
 
   void UnblockResetAndDrain();
   void CancelResetCompleteTimeout();
 
   bool mIsOpen;
--- a/dom/media/gmp/GMPVideoDecoderProxy.h
+++ b/dom/media/gmp/GMPVideoDecoderProxy.h
@@ -1,52 +1,53 @@
 /* -*- 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 GMPVideoDecoderProxy_h_
 #define GMPVideoDecoderProxy_h_
 
-#include "nsTArray.h"
-#include "gmp-video-decode.h"
-#include "gmp-video-frame-i420.h"
-#include "gmp-video-frame-encoded.h"
-
 #include "GMPCallbackBase.h"
 #include "GMPUtils.h"
+#include "gmp-video-decode.h"
+#include "gmp-video-frame-encoded.h"
+#include "gmp-video-frame-i420.h"
+#include "nsTArray.h"
 
 class GMPVideoDecoderCallbackProxy : public GMPCallbackBase,
                                      public GMPVideoDecoderCallback
 {
 public:
-  virtual ~GMPVideoDecoderCallbackProxy() {}
+  virtual ~GMPVideoDecoderCallbackProxy() { }
 };
 
 // A proxy to GMPVideoDecoder in the child process.
 // GMPVideoDecoderParent exposes this to users the GMP.
 // This enables Gecko to pass nsTArrays to the child GMP and avoid
 // an extra copy when doing so.
 
 // The consumer must call Close() when done with the codec, or when
 // Terminated() is called by the GMP plugin indicating an abnormal shutdown
 // of the underlying plugin.  After calling Close(), the consumer must
 // not access this again.
 
 // This interface is not thread-safe and must only be used from GMPThread.
-class GMPVideoDecoderProxy {
+class GMPVideoDecoderProxy
+{
 public:
   virtual nsresult InitDecode(const GMPVideoCodec& aCodecSettings,
                               const nsTArray<uint8_t>& aCodecSpecific,
                               GMPVideoDecoderCallbackProxy* aCallback,
                               int32_t aCoreCount) = 0;
-  virtual nsresult Decode(mozilla::GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
-                          bool aMissingFrames,
-                          const nsTArray<uint8_t>& aCodecSpecificInfo,
-                          int64_t aRenderTimeMs = -1) = 0;
+  virtual nsresult Decode(
+    mozilla::GMPUniquePtr<GMPVideoEncodedFrame> aInputFrame,
+    bool aMissingFrames,
+    const nsTArray<uint8_t>& aCodecSpecificInfo,
+    int64_t aRenderTimeMs = -1) = 0;
   virtual nsresult Reset() = 0;
   virtual nsresult Drain() = 0;
   virtual uint32_t GetPluginId() const = 0;
 
   // Call to tell GMP/plugin the consumer will no longer use this
   // interface/codec.
   virtual void Close() = 0;
 
--- a/dom/media/gmp/GMPVideoEncodedFrameImpl.cpp
+++ b/dom/media/gmp/GMPVideoEncodedFrameImpl.cpp
@@ -8,42 +8,43 @@
 #include "mozilla/gmp/GMPTypes.h"
 #include "GMPSharedMemManager.h"
 #include "GMPEncryptedBufferDataImpl.h"
 
 namespace mozilla {
 namespace gmp {
 
 GMPVideoEncodedFrameImpl::GMPVideoEncodedFrameImpl(GMPVideoHostImpl* aHost)
-: mEncodedWidth(0),
-  mEncodedHeight(0),
-  mTimeStamp(0ll),
-  mDuration(0ll),
-  mFrameType(kGMPDeltaFrame),
-  mSize(0),
-  mCompleteFrame(false),
-  mHost(aHost),
-  mBufferType(GMP_BufferSingle)
+  : mEncodedWidth(0)
+  , mEncodedHeight(0)
+  , mTimeStamp(0ll)
+  , mDuration(0ll)
+  , mFrameType(kGMPDeltaFrame)
+  , mSize(0)
+  , mCompleteFrame(false)
+  , mHost(aHost)
+  , mBufferType(GMP_BufferSingle)
 {
   MOZ_ASSERT(aHost);
   aHost->EncodedFrameCreated(this);
 }
 
-GMPVideoEncodedFrameImpl::GMPVideoEncodedFrameImpl(const GMPVideoEncodedFrameData& aFrameData,
-                                                   GMPVideoHostImpl* aHost)
-: mEncodedWidth(aFrameData.mEncodedWidth()),
-  mEncodedHeight(aFrameData.mEncodedHeight()),
-  mTimeStamp(aFrameData.mTimestamp()),
-  mDuration(aFrameData.mDuration()),
-  mFrameType(static_cast<GMPVideoFrameType>(aFrameData.mFrameType())),
-  mSize(aFrameData.mSize()),
-  mCompleteFrame(aFrameData.mCompleteFrame()),
-  mHost(aHost),
-  mBuffer(aFrameData.mBuffer()),
-  mBufferType(aFrameData.mBufferType())
+GMPVideoEncodedFrameImpl::GMPVideoEncodedFrameImpl(
+  const GMPVideoEncodedFrameData& aFrameData,
+  GMPVideoHostImpl* aHost)
+  : mEncodedWidth(aFrameData.mEncodedWidth())
+  , mEncodedHeight(aFrameData.mEncodedHeight())
+  , mTimeStamp(aFrameData.mTimestamp())
+  , mDuration(aFrameData.mDuration())
+  , mFrameType(static_cast<GMPVideoFrameType>(aFrameData.mFrameType()))
+  , mSize(aFrameData.mSize())
+  , mCompleteFrame(aFrameData.mCompleteFrame())
+  , mHost(aHost)
+  , mBuffer(aFrameData.mBuffer())
+  , mBufferType(aFrameData.mBufferType())
 {
   MOZ_ASSERT(aHost);
   if (aFrameData.mDecryptionData().mKeyId().Length() > 0) {
     mCrypto = new GMPEncryptedBufferDataImpl(aFrameData.mDecryptionData());
   }
   aHost->EncodedFrameCreated(this);
 }
 
@@ -89,17 +90,18 @@ GMPVideoEncodedFrameImpl::ActorDestroyed
   // Simply clear out Shmem reference, do not attempt to
   // properly free it. It has already been freed.
   mBuffer = ipc::Shmem();
   // No more host.
   mHost = nullptr;
 }
 
 bool
-GMPVideoEncodedFrameImpl::RelinquishFrameData(GMPVideoEncodedFrameData& aFrameData)
+GMPVideoEncodedFrameImpl::RelinquishFrameData(
+  GMPVideoEncodedFrameData& aFrameData)
 {
   aFrameData.mEncodedWidth() = mEncodedWidth;
   aFrameData.mEncodedHeight() = mEncodedHeight;
   aFrameData.mTimestamp() = mTimeStamp;
   aFrameData.mDuration() = mDuration;
   aFrameData.mFrameType() = mFrameType;
   aFrameData.mSize() = mSize;
   aFrameData.mCompleteFrame() = mCompleteFrame;
@@ -116,31 +118,34 @@ GMPVideoEncodedFrameImpl::RelinquishFram
 
   return true;
 }
 
 void
 GMPVideoEncodedFrameImpl::DestroyBuffer()
 {
   if (mHost && mBuffer.IsWritable()) {
-    mHost->SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPEncodedData, mBuffer);
+    mHost->SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPEncodedData,
+                                           mBuffer);
   }
   mBuffer = ipc::Shmem();
 }
 
 GMPErr
 GMPVideoEncodedFrameImpl::CreateEmptyFrame(uint32_t aSize)
 {
   if (aSize == 0) {
     DestroyBuffer();
   } else if (aSize > AllocatedSize()) {
     DestroyBuffer();
-    if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPEncodedData, aSize,
-                                              ipc::SharedMemory::TYPE_BASIC, &mBuffer) ||
-        !Buffer()) {
+    if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPEncodedData,
+                                              aSize,
+                                              ipc::SharedMemory::TYPE_BASIC,
+                                              &mBuffer)
+        || !Buffer()) {
       return GMPAllocErr;
     }
   }
   mSize = aSize;
 
   return GMPNoErr;
 }
 
@@ -160,17 +165,18 @@ GMPVideoEncodedFrameImpl::CopyFrame(cons
   mEncodedHeight = f.mEncodedHeight;
   mTimeStamp = f.mTimeStamp;
   mDuration = f.mDuration;
   mFrameType = f.mFrameType;
   mSize = f.mSize; // already set...
   mCompleteFrame = f.mCompleteFrame;
   mBufferType = f.mBufferType;
   mCrypto = new GMPEncryptedBufferDataImpl(*(f.mCrypto));
-  // Don't copy host, that should have been set properly on object creation via host.
+  // Don't copy host, that should have been set properly on object creation via
+  // host.
 
   return GMPNoErr;
 }
 
 void
 GMPVideoEncodedFrameImpl::SetEncodedWidth(uint32_t aEncodedWidth)
 {
   mEncodedWidth = aEncodedWidth;
@@ -237,19 +243,21 @@ GMPVideoEncodedFrameImpl::SetAllocatedSi
     return;
   }
 
   if (!mHost) {
     return;
   }
 
   ipc::Shmem new_mem;
-  if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPEncodedData, aNewSize,
-                                            ipc::SharedMemory::TYPE_BASIC, &new_mem) ||
-      !new_mem.get<uint8_t>()) {
+  if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPEncodedData,
+                                            aNewSize,
+                                            ipc::SharedMemory::TYPE_BASIC,
+                                            &new_mem)
+      || !new_mem.get<uint8_t>()) {
     return;
   }
 
   if (mBuffer.IsReadable()) {
     memcpy(new_mem.get<uint8_t>(), Buffer(), mSize);
   }
 
   DestroyBuffer();
--- a/dom/media/gmp/GMPVideoEncodedFrameImpl.h
+++ b/dom/media/gmp/GMPVideoEncodedFrameImpl.h
@@ -47,17 +47,18 @@ class GMPVideoHostImpl;
 class GMPVideoEncodedFrameData;
 class GMPEncryptedBufferDataImpl;
 
 class GMPVideoEncodedFrameImpl: public GMPVideoEncodedFrame
 {
   friend struct IPC::ParamTraits<mozilla::gmp::GMPVideoEncodedFrameImpl>;
 public:
   explicit GMPVideoEncodedFrameImpl(GMPVideoHostImpl* aHost);
-  GMPVideoEncodedFrameImpl(const GMPVideoEncodedFrameData& aFrameData, GMPVideoHostImpl* aHost);
+  GMPVideoEncodedFrameImpl(const GMPVideoEncodedFrameData& aFrameData,
+                           GMPVideoHostImpl* aHost);
   virtual ~GMPVideoEncodedFrameImpl();
 
   void InitCrypto(const CryptoSample& aCrypto);
 
   // This is called during a normal destroy sequence, which is
   // when a consumer is finished or during XPCOM shutdown.
   void DoneWithAPI();
   // Does not attempt to release Shmem, as the Shmem has already been released.
@@ -65,44 +66,44 @@ public:
 
   bool RelinquishFrameData(GMPVideoEncodedFrameData& aFrameData);
 
   // GMPVideoFrame
   GMPVideoFrameFormat GetFrameFormat() override;
   void Destroy() override;
 
   // GMPVideoEncodedFrame
-  GMPErr   CreateEmptyFrame(uint32_t aSize) override;
-  GMPErr   CopyFrame(const GMPVideoEncodedFrame& aFrame) override;
-  void     SetEncodedWidth(uint32_t aEncodedWidth) override;
+  GMPErr CreateEmptyFrame(uint32_t aSize) override;
+  GMPErr CopyFrame(const GMPVideoEncodedFrame& aFrame) override;
+  void SetEncodedWidth(uint32_t aEncodedWidth) override;
   uint32_t EncodedWidth() override;
-  void     SetEncodedHeight(uint32_t aEncodedHeight) override;
+  void SetEncodedHeight(uint32_t aEncodedHeight) override;
   uint32_t EncodedHeight() override;
   // Microseconds
-  void     SetTimeStamp(uint64_t aTimeStamp) override;
+  void SetTimeStamp(uint64_t aTimeStamp) override;
   uint64_t TimeStamp() override;
   // Set frame duration (microseconds)
   // NOTE: next-frame's Timestamp() != this-frame's TimeStamp()+Duration()
   // depending on rounding to avoid having to track roundoff errors
   // and dropped/missing frames(!) (which may leave a large gap)
-  void     SetDuration(uint64_t aDuration) override;
+  void SetDuration(uint64_t aDuration) override;
   uint64_t Duration() const override;
-  void     SetFrameType(GMPVideoFrameType aFrameType) override;
+  void SetFrameType(GMPVideoFrameType aFrameType) override;
   GMPVideoFrameType FrameType() override;
-  void     SetAllocatedSize(uint32_t aNewSize) override;
+  void SetAllocatedSize(uint32_t aNewSize) override;
   uint32_t AllocatedSize() override;
-  void     SetSize(uint32_t aSize) override;
+  void SetSize(uint32_t aSize) override;
   uint32_t Size() override;
-  void     SetCompleteFrame(bool aCompleteFrame) override;
-  bool     CompleteFrame() override;
+  void SetCompleteFrame(bool aCompleteFrame) override;
+  bool CompleteFrame() override;
   const uint8_t* Buffer() const override;
   uint8_t* Buffer() override;
   GMPBufferType BufferType() const override;
-  void     SetBufferType(GMPBufferType aBufferType) override;
-  const    GMPEncryptedBufferMetadata* GetDecryptionData() const override;
+  void SetBufferType(GMPBufferType aBufferType) override;
+  const GMPEncryptedBufferMetadata* GetDecryptionData() const override;
 
 private:
   void DestroyBuffer();
 
   uint32_t mEncodedWidth;
   uint32_t mEncodedHeight;
   uint64_t mTimeStamp;
   uint64_t mDuration;
--- a/dom/media/gmp/GMPVideoEncoderChild.cpp
+++ b/dom/media/gmp/GMPVideoEncoderChild.cpp
@@ -28,17 +28,18 @@ GMPVideoEncoderChild::GMPVideoEncoderChi
 GMPVideoEncoderChild::~GMPVideoEncoderChild()
 {
   MOZ_ASSERT(!mNeedShmemIntrCount);
 }
 
 void
 GMPVideoEncoderChild::Init(GMPVideoEncoder* aEncoder)
 {
-  MOZ_ASSERT(aEncoder, "Cannot initialize video encoder child without a video encoder!");
+  MOZ_ASSERT(aEncoder,
+             "Cannot initialize video encoder child without a video encoder!");
   mVideoEncoder = aEncoder;
 }
 
 GMPVideoHostImpl&
 GMPVideoEncoderChild::Host()
 {
   return mVideoHost;
 }
@@ -87,19 +88,20 @@ GMPVideoEncoderChild::RecvInitEncode(con
                             this,
                             aNumberOfCores,
                             aMaxPayloadSize);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-GMPVideoEncoderChild::RecvEncode(const GMPVideoi420FrameData& aInputFrame,
-                                 InfallibleTArray<uint8_t>&& aCodecSpecificInfo,
-                                 InfallibleTArray<GMPVideoFrameType>&& aFrameTypes)
+GMPVideoEncoderChild::RecvEncode(
+  const GMPVideoi420FrameData& aInputFrame,
+  InfallibleTArray<uint8_t>&& aCodecSpecificInfo,
+  InfallibleTArray<GMPVideoFrameType>&& aFrameTypes)
 {
   if (!mVideoEncoder) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   auto f = new GMPVideoi420FrameImpl(aInputFrame, &mVideoHost);
 
   // Ignore any return code. It is OK for this to fail without killing the process.
@@ -125,44 +127,47 @@ GMPVideoEncoderChild::RecvChildShmemForP
 mozilla::ipc::IPCResult
 GMPVideoEncoderChild::RecvSetChannelParameters(const uint32_t& aPacketLoss,
                                                const uint32_t& aRTT)
 {
   if (!mVideoEncoder) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mVideoEncoder->SetChannelParameters(aPacketLoss, aRTT);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoEncoderChild::RecvSetRates(const uint32_t& aNewBitRate,
                                    const uint32_t& aFrameRate)
 {
   if (!mVideoEncoder) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mVideoEncoder->SetRates(aNewBitRate, aFrameRate);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoEncoderChild::RecvSetPeriodicKeyFrames(const bool& aEnable)
 {
   if (!mVideoEncoder) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mVideoEncoder->SetPeriodicKeyFrames(aEnable);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoEncoderChild::RecvEncodingComplete()
 {
@@ -177,17 +182,18 @@ GMPVideoEncoderChild::RecvEncodingComple
     return IPC_OK();
   }
 
   if (!mVideoEncoder) {
     Unused << Send__delete__(this);
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mVideoEncoder->EncodingComplete();
 
   mVideoHost.DoneWithAPI();
 
   mPlugin = nullptr;
 
   Unused << Send__delete__(this);
 
--- a/dom/media/gmp/GMPVideoEncoderChild.h
+++ b/dom/media/gmp/GMPVideoEncoderChild.h
@@ -1,21 +1,21 @@
 /* -*- 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 GMPVideoEncoderChild_h_
 #define GMPVideoEncoderChild_h_
 
-#include "nsString.h"
-#include "mozilla/gmp/PGMPVideoEncoderChild.h"
-#include "gmp-video-encode.h"
 #include "GMPSharedMemManager.h"
 #include "GMPVideoHost.h"
+#include "gmp-video-encode.h"
+#include "mozilla/gmp/PGMPVideoEncoderChild.h"
+#include "nsString.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPContentChild;
 
 class GMPVideoEncoderChild : public PGMPVideoEncoderChild,
                              public GMPVideoEncoderCallback,
@@ -39,29 +39,34 @@ public:
   bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType,
     Shmem* aMem) override;
   void Dealloc(Shmem& aMem) override;
 
 private:
   virtual ~GMPVideoEncoderChild();
 
   // PGMPVideoEncoderChild
-  mozilla::ipc::IPCResult RecvInitEncode(const GMPVideoCodec& aCodecSettings,
-                                         InfallibleTArray<uint8_t>&& aCodecSpecific,
-                                         const int32_t& aNumberOfCores,
-                                         const uint32_t& aMaxPayloadSize) override;
-  mozilla::ipc::IPCResult RecvEncode(const GMPVideoi420FrameData& aInputFrame,
-                                     InfallibleTArray<uint8_t>&& aCodecSpecificInfo,
-                                     InfallibleTArray<GMPVideoFrameType>&& aFrameTypes) override;
-  mozilla::ipc::IPCResult RecvChildShmemForPool(Shmem&& aEncodedBuffer) override;
-  mozilla::ipc::IPCResult RecvSetChannelParameters(const uint32_t& aPacketLoss,
-                                                   const uint32_t& aRTT) override;
+  mozilla::ipc::IPCResult RecvInitEncode(
+    const GMPVideoCodec& aCodecSettings,
+    InfallibleTArray<uint8_t>&& aCodecSpecific,
+    const int32_t& aNumberOfCores,
+    const uint32_t& aMaxPayloadSize) override;
+  mozilla::ipc::IPCResult RecvEncode(
+    const GMPVideoi420FrameData& aInputFrame,
+    InfallibleTArray<uint8_t>&& aCodecSpecificInfo,
+    InfallibleTArray<GMPVideoFrameType>&& aFrameTypes) override;
+  mozilla::ipc::IPCResult RecvChildShmemForPool(
+    Shmem&& aEncodedBuffer) override;
+  mozilla::ipc::IPCResult RecvSetChannelParameters(
+    const uint32_t& aPacketLoss,
+    const uint32_t& aRTT) override;
   mozilla::ipc::IPCResult RecvSetRates(const uint32_t& aNewBitRate,
                                        const uint32_t& aFrameRate) override;
-  mozilla::ipc::IPCResult RecvSetPeriodicKeyFrames(const bool& aEnable) override;
+  mozilla::ipc::IPCResult RecvSetPeriodicKeyFrames(
+    const bool& aEnable) override;
   mozilla::ipc::IPCResult RecvEncodingComplete() override;
 
   GMPContentChild* mPlugin;
   GMPVideoEncoder* mVideoEncoder;
   GMPVideoHostImpl mVideoHost;
 
   // Non-zero when a GMP is blocked spinning the IPC message loop while
   // waiting on an NeedShmem to complete.
--- a/dom/media/gmp/GMPVideoEncoderParent.cpp
+++ b/dom/media/gmp/GMPVideoEncoderParent.cpp
@@ -1,26 +1,26 @@
 /* -*- 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/. */
 
 #include "GMPVideoEncoderParent.h"
-#include "mozilla/Logging.h"
+#include "GMPContentParent.h"
+#include "GMPMessageUtils.h"
+#include "GMPUtils.h"
+#include "GMPVideoEncodedFrameImpl.h"
 #include "GMPVideoi420FrameImpl.h"
-#include "GMPVideoEncodedFrameImpl.h"
+#include "mozilla/Logging.h"
 #include "mozilla/Unused.h"
-#include "GMPMessageUtils.h"
+#include "mozilla/gmp/GMPTypes.h"
 #include "nsAutoRef.h"
-#include "GMPContentParent.h"
-#include "mozilla/gmp/GMPTypes.h"
 #include "nsThread.h"
 #include "nsThreadUtils.h"
 #include "runnable_utils.h"
-#include "GMPUtils.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
 extern LogModule* GetGMPLog();
@@ -40,25 +40,25 @@ namespace gmp {
 //    on InitDecode success -> Open
 //    on Shutdown -> Dead
 // Open: mIsOpen == true
 //    on Close -> Dead
 //    on ActorDestroy -> Dead
 //    on Shutdown -> Dead
 // Dead: mIsOpen == false
 
-GMPVideoEncoderParent::GMPVideoEncoderParent(GMPContentParent *aPlugin)
-: GMPSharedMemManager(aPlugin),
-  mIsOpen(false),
-  mShuttingDown(false),
-  mActorDestroyed(false),
-  mPlugin(aPlugin),
-  mCallback(nullptr),
-  mVideoHost(this),
-  mPluginId(aPlugin->GetPluginId())
+GMPVideoEncoderParent::GMPVideoEncoderParent(GMPContentParent* aPlugin)
+  : GMPSharedMemManager(aPlugin)
+  , mIsOpen(false)
+  , mShuttingDown(false)
+  , mActorDestroyed(false)
+  , mPlugin(aPlugin)
+  , mCallback(nullptr)
+  , mVideoHost(this)
+  , mPluginId(aPlugin->GetPluginId())
 {
   MOZ_ASSERT(mPlugin);
 
   nsresult rv = NS_NewNamedThread("GMPEncoded", getter_AddRefs(mEncodedThread));
   if (NS_FAILED(rv)) {
     MOZ_CRASH();
   }
 }
@@ -108,17 +108,18 @@ GMPVideoEncoderParent::InitEncode(const 
 
   MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
 
   if (!aCallback) {
     return GMPGenericErr;
   }
   mCallback = aCallback;
 
-  if (!SendInitEncode(aCodecSettings, aCodecSpecific, aNumberOfCores, aMaxPayloadSize)) {
+  if (!SendInitEncode(
+        aCodecSettings, aCodecSpecific, aNumberOfCores, aMaxPayloadSize)) {
     return GMPGenericErr;
   }
   mIsOpen = true;
 
   // Async IPC, we don't have access to a return value.
   return GMPNoErr;
 }
 
@@ -135,18 +136,19 @@ GMPVideoEncoderParent::Encode(GMPUniqueP
   MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
 
   GMPUniquePtr<GMPVideoi420FrameImpl> inputFrameImpl(
     static_cast<GMPVideoi420FrameImpl*>(aInputFrame.release()));
 
   // Very rough kill-switch if the plugin stops processing.  If it's merely
   // hung and continues, we'll come back to life eventually.
   // 3* is because we're using 3 buffers per frame for i420 data for now.
-  if ((NumInUse(GMPSharedMem::kGMPFrameData) > 3*GMPSharedMem::kGMPBufLimit) ||
-      (NumInUse(GMPSharedMem::kGMPEncodedData) > GMPSharedMem::kGMPBufLimit)) {
+  if ((NumInUse(GMPSharedMem::kGMPFrameData) > 3 * GMPSharedMem::kGMPBufLimit)
+      || (NumInUse(GMPSharedMem::kGMPEncodedData)
+          > GMPSharedMem::kGMPBufLimit)) {
     return GMPGenericErr;
   }
 
   GMPVideoi420FrameData frameData;
   inputFrameImpl->InitFrameData(frameData);
 
   if (!SendEncode(frameData,
                   aCodecSpecificInfo,
@@ -254,22 +256,23 @@ GMPVideoEncoderParent::ActorDestroy(Acto
     mCallback->Terminated();
     mCallback = nullptr;
   }
   // Must be shut down before VideoEncoderDestroyed(), since this can recurse
   // the GMPThread event loop.  See bug 1049501
   if (mEncodedThread) {
     // Can't get it to allow me to use WrapRunnable with a nsCOMPtr<nsIThread>()
     NS_DispatchToMainThread(
-      WrapRunnableNM<decltype(&ShutdownEncodedThread),
-                     nsCOMPtr<nsIThread> >(&ShutdownEncodedThread, mEncodedThread));
+      WrapRunnableNM<decltype(&ShutdownEncodedThread), nsCOMPtr<nsIThread>>(
+        &ShutdownEncodedThread, mEncodedThread));
     mEncodedThread = nullptr;
   }
   if (mPlugin) {
-    // Ignore any return code. It is OK for this to fail without killing the process.
+    // Ignore any return code. It is OK for this to fail without killing the
+    // process.
     mPlugin->VideoEncoderDestroyed(this);
     mPlugin = nullptr;
   }
   mVideoHost.ActorDestroyed(); // same as DoneWithAPI
   MaybeDisconnect(aWhy == AbnormalShutdown);
 }
 
 static void
@@ -283,43 +286,46 @@ EncodedCallback(GMPVideoEncoderCallbackP
   // Ugh.  Must destroy the frame on GMPThread.
   // XXX add locks to the ShmemManager instead?
   aThread->Dispatch(WrapRunnable(aEncodedFrame,
                                 &GMPVideoEncodedFrame::Destroy),
                    NS_DISPATCH_NORMAL);
 }
 
 mozilla::ipc::IPCResult
-GMPVideoEncoderParent::RecvEncoded(const GMPVideoEncodedFrameData& aEncodedFrame,
-                                   InfallibleTArray<uint8_t>&& aCodecSpecificInfo)
+GMPVideoEncoderParent::RecvEncoded(
+  const GMPVideoEncodedFrameData& aEncodedFrame,
+  InfallibleTArray<uint8_t>&& aCodecSpecificInfo)
 {
   if (!mCallback) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   auto f = new GMPVideoEncodedFrameImpl(aEncodedFrame, &mVideoHost);
   nsTArray<uint8_t> *codecSpecificInfo = new nsTArray<uint8_t>;
-  codecSpecificInfo->AppendElements((uint8_t*)aCodecSpecificInfo.Elements(), aCodecSpecificInfo.Length());
+  codecSpecificInfo->AppendElements((uint8_t*)aCodecSpecificInfo.Elements(),
+                                    aCodecSpecificInfo.Length());
   nsCOMPtr<nsIThread> thread = NS_GetCurrentThread();
 
-  mEncodedThread->Dispatch(WrapRunnableNM(&EncodedCallback,
-                                          mCallback, f, codecSpecificInfo, thread),
-                           NS_DISPATCH_NORMAL);
+  mEncodedThread->Dispatch(
+    WrapRunnableNM(&EncodedCallback, mCallback, f, codecSpecificInfo, thread),
+    NS_DISPATCH_NORMAL);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoEncoderParent::RecvError(const GMPErr& aError)
 {
   if (!mCallback) {
     return IPC_FAIL_NO_REASON(this);
   }
 
-  // Ignore any return code. It is OK for this to fail without killing the process.
+  // Ignore any return code. It is OK for this to fail without killing the
+  // process.
   mCallback->Error(aError);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoEncoderParent::RecvShutdown()
 {
@@ -332,50 +338,58 @@ GMPVideoEncoderParent::RecvParentShmemFo
 {
   if (aFrameBuffer.IsWritable()) {
     // This test may be paranoia now that we don't shut down the VideoHost
     // in ::Shutdown, but doesn't hurt
     if (mVideoHost.SharedMemMgr()) {
       mVideoHost.SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPFrameData,
                                                  aFrameBuffer);
     } else {
-      LOGD(("%s::%s: %p Called in shutdown, ignoring and freeing directly", __CLASS__, __FUNCTION__, this));
+      LOGD(("%s::%s: %p Called in shutdown, ignoring and freeing directly",
+            __CLASS__,
+            __FUNCTION__,
+            this));
       DeallocShmem(aFrameBuffer);
     }
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoEncoderParent::AnswerNeedShmem(const uint32_t& aEncodedBufferSize,
                                        Shmem* aMem)
 {
   ipc::Shmem mem;
 
   // This test may be paranoia now that we don't shut down the VideoHost
   // in ::Shutdown, but doesn't hurt
-  if (!mVideoHost.SharedMemMgr() ||
-      !mVideoHost.SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPEncodedData,
-                                                aEncodedBufferSize,
-                                                ipc::SharedMemory::TYPE_BASIC, &mem))
-  {
-    LOG(LogLevel::Error, ("%s::%s: Failed to get a shared mem buffer for Child! size %u",
-                       __CLASS__, __FUNCTION__, aEncodedBufferSize));
+  if (!mVideoHost.SharedMemMgr()
+      || !mVideoHost.SharedMemMgr()
+           ->MgrAllocShmem(GMPSharedMem::kGMPEncodedData,
+                           aEncodedBufferSize,
+                           ipc::SharedMemory::TYPE_BASIC,
+                           &mem)) {
+    LOG(LogLevel::Error,
+        ("%s::%s: Failed to get a shared mem buffer for Child! size %u",
+         __CLASS__,
+         __FUNCTION__,
+         aEncodedBufferSize));
     return IPC_FAIL_NO_REASON(this);
   }
   *aMem = mem;
   mem = ipc::Shmem();
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 GMPVideoEncoderParent::Recv__delete__()
 {
   if (mPlugin) {
-    // Ignore any return code. It is OK for this to fail without killing the process.
+    // Ignore any return code. It is OK for this to fail without killing the
+    // process.
     mPlugin->VideoEncoderDestroyed(this);
     mPlugin = nullptr;
   }
 
   return IPC_OK();
 }
 
 } // namespace gmp
--- a/dom/media/gmp/GMPVideoEncoderParent.h
+++ b/dom/media/gmp/GMPVideoEncoderParent.h
@@ -1,25 +1,25 @@
 /* -*- 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 GMPVideoEncoderParent_h_
 #define GMPVideoEncoderParent_h_
 
-#include "mozilla/RefPtr.h"
-#include "gmp-video-encode.h"
-#include "mozilla/gmp/PGMPVideoEncoderParent.h"
+#include "GMPCrashHelperHolder.h"
 #include "GMPMessageUtils.h"
 #include "GMPSharedMemManager.h"
 #include "GMPUtils.h"
+#include "GMPVideoEncoderProxy.h"
 #include "GMPVideoHost.h"
-#include "GMPVideoEncoderProxy.h"
-#include "GMPCrashHelperHolder.h"
+#include "gmp-video-encode.h"
+#include "mozilla/RefPtr.h"
+#include "mozilla/gmp/PGMPVideoEncoderParent.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPContentParent;
 
 class GMPVideoEncoderParent : public GMPVideoEncoderProxy,
                               public PGMPVideoEncoderParent,
@@ -45,17 +45,19 @@ public:
                 const nsTArray<uint8_t>& aCodecSpecificInfo,
                 const nsTArray<GMPVideoFrameType>& aFrameTypes) override;
   GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) override;
   GMPErr SetRates(uint32_t aNewBitRate, uint32_t aFrameRate) override;
   GMPErr SetPeriodicKeyFrames(bool aEnable) override;
   uint32_t GetPluginId() const override { return mPluginId; }
 
   // GMPSharedMemManager
-  bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) override
+  bool Alloc(size_t aSize,
+             Shmem::SharedMemory::SharedMemoryType aType,
+             Shmem* aMem) override
   {
 #ifdef GMP_SAFE_SHMEM
     return AllocShmem(aSize, aType, aMem);
 #else
     return AllocUnsafeShmem(aSize, aType, aMem);
 #endif
   }
   void Dealloc(Shmem& aMem) override
@@ -63,18 +65,19 @@ public:
     DeallocShmem(aMem);
   }
 
 private:
   virtual ~GMPVideoEncoderParent();
 
   // PGMPVideoEncoderParent
   void ActorDestroy(ActorDestroyReason aWhy) override;
-  mozilla::ipc::IPCResult RecvEncoded(const GMPVideoEncodedFrameData& aEncodedFrame,
-                                      InfallibleTArray<uint8_t>&& aCodecSpecificInfo) override;
+  mozilla::ipc::IPCResult RecvEncoded(
+    const GMPVideoEncodedFrameData& aEncodedFrame,
+    InfallibleTArray<uint8_t>&& aCodecSpecificInfo) override;
   mozilla::ipc::IPCResult RecvError(const GMPErr& aError) override;
   mozilla::ipc::IPCResult RecvShutdown() override;
   mozilla::ipc::IPCResult RecvParentShmemForPool(Shmem&& aFrameBuffer) override;
   mozilla::ipc::IPCResult AnswerNeedShmem(const uint32_t& aEncodedBufferSize,
                                           Shmem* aMem) override;
   mozilla::ipc::IPCResult Recv__delete__() override;
 
   bool mIsOpen;
--- a/dom/media/gmp/GMPVideoEncoderProxy.h
+++ b/dom/media/gmp/GMPVideoEncoderProxy.h
@@ -1,44 +1,46 @@
 /* -*- 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 GMPVideoEncoderProxy_h_
 #define GMPVideoEncoderProxy_h_
 
+#include "gmp-video-encode.h"
+#include "gmp-video-frame-encoded.h"
+#include "gmp-video-frame-i420.h"
 #include "nsTArray.h"
-#include "gmp-video-encode.h"
-#include "gmp-video-frame-i420.h"
-#include "gmp-video-frame-encoded.h"
 
 #include "GMPCallbackBase.h"
 #include "GMPUtils.h"
 
-class GMPVideoEncoderCallbackProxy : public GMPCallbackBase {
+class GMPVideoEncoderCallbackProxy : public GMPCallbackBase
+{
 public:
-  virtual ~GMPVideoEncoderCallbackProxy() {}
+  virtual ~GMPVideoEncoderCallbackProxy() { }
   virtual void Encoded(GMPVideoEncodedFrame* aEncodedFrame,
                        const nsTArray<uint8_t>& aCodecSpecificInfo) = 0;
   virtual void Error(GMPErr aError) = 0;
 };
 
 // A proxy to GMPVideoEncoder in the child process.
 // GMPVideoEncoderParent exposes this to users the GMP.
 // This enables Gecko to pass nsTArrays to the child GMP and avoid
 // an extra copy when doing so.
 
 // The consumer must call Close() when done with the codec, or when
 // Terminated() is called by the GMP plugin indicating an abnormal shutdown
 // of the underlying plugin.  After calling Close(), the consumer must
 // not access this again.
 
 // This interface is not thread-safe and must only be used from GMPThread.
-class GMPVideoEncoderProxy {
+class GMPVideoEncoderProxy
+{
 public:
   virtual GMPErr InitEncode(const GMPVideoCodec& aCodecSettings,
                             const nsTArray<uint8_t>& aCodecSpecific,
                             GMPVideoEncoderCallbackProxy* aCallback,
                             int32_t aNumberOfCores,
                             uint32_t aMaxPayloadSize) = 0;
   virtual GMPErr Encode(mozilla::GMPUniquePtr<GMPVideoi420Frame> aInputFrame,
                         const nsTArray<uint8_t>& aCodecSpecificInfo,
--- a/dom/media/gmp/GMPVideoHost.cpp
+++ b/dom/media/gmp/GMPVideoHost.cpp
@@ -1,32 +1,33 @@
 /* -*- 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/. */
 
 #include "GMPVideoHost.h"
-#include "mozilla/Assertions.h"
+#include "GMPVideoEncodedFrameImpl.h"
 #include "GMPVideoi420FrameImpl.h"
-#include "GMPVideoEncodedFrameImpl.h"
+#include "mozilla/Assertions.h"
 
 namespace mozilla {
 namespace gmp {
 
 GMPVideoHostImpl::GMPVideoHostImpl(GMPSharedMemManager* aSharedMemMgr)
-: mSharedMemMgr(aSharedMemMgr)
+  : mSharedMemMgr(aSharedMemMgr)
 {
 }
 
 GMPVideoHostImpl::~GMPVideoHostImpl()
 {
 }
 
 GMPErr
-GMPVideoHostImpl::CreateFrame(GMPVideoFrameFormat aFormat, GMPVideoFrame** aFrame)
+GMPVideoHostImpl::CreateFrame(GMPVideoFrameFormat aFormat,
+                              GMPVideoFrame** aFrame)
 {
   if (!mSharedMemMgr) {
     return GMPGenericErr;
   }
 
   if (!aFrame) {
     return GMPGenericErr;
   }
--- a/dom/media/gmp/GMPVideoHost.h
+++ b/dom/media/gmp/GMPVideoHost.h
@@ -1,20 +1,19 @@
 /* -*- 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 GMPVideoHost_h_
 #define GMPVideoHost_h_
 
+#include "gmp-video-frame.h"
 #include "gmp-video-host.h"
 #include "gmp-video-plane.h"
-#include "gmp-video-frame.h"
-#include "gmp-video-host.h"
 #include "nsTArray.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPSharedMemManager;
 class GMPPlaneImpl;
 class GMPVideoEncodedFrameImpl;
@@ -30,17 +29,18 @@ public:
   void DoneWithAPI();
   void ActorDestroyed();
   void PlaneCreated(GMPPlaneImpl* aPlane);
   void PlaneDestroyed(GMPPlaneImpl* aPlane);
   void EncodedFrameCreated(GMPVideoEncodedFrameImpl* aEncodedFrame);
   void EncodedFrameDestroyed(GMPVideoEncodedFrameImpl* aFrame);
 
   // GMPVideoHost
-  GMPErr CreateFrame(GMPVideoFrameFormat aFormat, GMPVideoFrame** aFrame) override;
+  GMPErr CreateFrame(GMPVideoFrameFormat aFormat,
+                     GMPVideoFrame** aFrame) override;
   GMPErr CreatePlane(GMPPlane** aPlane) override;
 
 private:
   // All shared memory allocations have to be made by an IPDL actor.
   // This is a reference to the owning actor. If this reference is
   // null then the actor has died and all allocations must fail.
   GMPSharedMemManager* mSharedMemMgr;
 
--- a/dom/media/gmp/GMPVideoPlaneImpl.cpp
+++ b/dom/media/gmp/GMPVideoPlaneImpl.cpp
@@ -1,35 +1,36 @@
 /* -*- 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/. */
 
 #include "GMPVideoPlaneImpl.h"
-#include "mozilla/gmp/GMPTypes.h"
+#include "GMPSharedMemManager.h"
 #include "GMPVideoHost.h"
-#include "GMPSharedMemManager.h"
+#include "mozilla/gmp/GMPTypes.h"
 
 namespace mozilla {
 namespace gmp {
 
 GMPPlaneImpl::GMPPlaneImpl(GMPVideoHostImpl* aHost)
 : mSize(0),
   mStride(0),
   mHost(aHost)
 {
   MOZ_ASSERT(mHost);
   mHost->PlaneCreated(this);
 }
 
-GMPPlaneImpl::GMPPlaneImpl(const GMPPlaneData& aPlaneData, GMPVideoHostImpl* aHost)
-: mBuffer(aPlaneData.mBuffer()),
-  mSize(aPlaneData.mSize()),
-  mStride(aPlaneData.mStride()),
-  mHost(aHost)
+GMPPlaneImpl::GMPPlaneImpl(const GMPPlaneData& aPlaneData,
+                           GMPVideoHostImpl* aHost)
+  : mBuffer(aPlaneData.mBuffer())
+  , mSize(aPlaneData.mSize())
+  , mStride(aPlaneData.mStride())
+  , mHost(aHost)
 {
   MOZ_ASSERT(mHost);
   mHost->PlaneCreated(this);
 }
 
 GMPPlaneImpl::~GMPPlaneImpl()
 {
   DestroyBuffer();
@@ -69,29 +70,32 @@ GMPPlaneImpl::InitPlaneData(GMPPlaneData
   // We need to effectively zero out our member copy so that we don't
   // try to delete memory we don't own later.
   mBuffer = ipc::Shmem();
 
   return true;
 }
 
 GMPErr
-GMPPlaneImpl::MaybeResize(int32_t aNewSize) {
+GMPPlaneImpl::MaybeResize(int32_t aNewSize)
+{
   if (aNewSize <= AllocatedSize()) {
     return GMPNoErr;
   }
 
   if (!mHost) {
     return GMPGenericErr;
   }
 
   ipc::Shmem new_mem;
-  if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPFrameData, aNewSize,
-                                            ipc::SharedMemory::TYPE_BASIC, &new_mem) ||
-      !new_mem.get<uint8_t>()) {
+  if (!mHost->SharedMemMgr()->MgrAllocShmem(GMPSharedMem::kGMPFrameData,
+                                            aNewSize,
+                                            ipc::SharedMemory::TYPE_BASIC,
+                                            &new_mem)
+      || !new_mem.get<uint8_t>()) {
     return GMPAllocErr;
   }
 
   if (mBuffer.IsReadable()) {
     memcpy(new_mem.get<uint8_t>(), Buffer(), mSize);
   }
 
   DestroyBuffer();
@@ -100,23 +104,26 @@ GMPPlaneImpl::MaybeResize(int32_t aNewSi
 
   return GMPNoErr;
 }
 
 void
 GMPPlaneImpl::DestroyBuffer()
 {
   if (mHost && mBuffer.IsWritable()) {
-    mHost->SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPFrameData, mBuffer);
+    mHost->SharedMemMgr()->MgrDeallocShmem(GMPSharedMem::kGMPFrameData,
+                                           mBuffer);
   }
   mBuffer = ipc::Shmem();
 }
 
 GMPErr
-GMPPlaneImpl::CreateEmptyPlane(int32_t aAllocatedSize, int32_t aStride, int32_t aPlaneSize)
+GMPPlaneImpl::CreateEmptyPlane(int32_t aAllocatedSize,
+                               int32_t aStride,
+                               int32_t aPlaneSize)
 {
   if (aAllocatedSize < 1 || aStride < 1 || aPlaneSize < 1) {
     return GMPGenericErr;
   }
 
   GMPErr err = MaybeResize(aAllocatedSize);
   if (err != GMPNoErr) {
     return err;
--- a/dom/media/gmp/GMPVideoPlaneImpl.h
+++ b/dom/media/gmp/GMPVideoPlaneImpl.h
@@ -33,19 +33,17 @@ public:
 
   bool InitPlaneData(GMPPlaneData& aPlaneData);
 
   // GMPPlane
   GMPErr CreateEmptyPlane(int32_t aAllocatedSize,
                           int32_t aStride,
                           int32_t aPlaneSize) override;
   GMPErr Copy(const GMPPlane& aPlane) override;
-  GMPErr Copy(int32_t aSize,
-              int32_t aStride,
-              const uint8_t* aBuffer) override;
+  GMPErr Copy(int32_t aSize, int32_t aStride, const uint8_t* aBuffer) override;
   void Swap(GMPPlane& aPlane) override;
   int32_t AllocatedSize() const override;
   void ResetSize() override;
   bool IsZeroSize() const override;
   int32_t Stride() const override;
   const uint8_t* Buffer() const override;
   uint8_t* Buffer() override;
   void Destroy() override;
--- a/dom/media/gmp/GMPVideoi420FrameImpl.cpp
+++ b/dom/media/gmp/GMPVideoi420FrameImpl.cpp
@@ -5,43 +5,42 @@
 
 #include "GMPVideoi420FrameImpl.h"
 #include "mozilla/gmp/GMPTypes.h"
 
 namespace mozilla {
 namespace gmp {
 
 GMPVideoi420FrameImpl::GMPVideoi420FrameImpl(GMPVideoHostImpl* aHost)
-: mYPlane(aHost),
-  mUPlane(aHost),
-  mVPlane(aHost),
-  mWidth(0),
-  mHeight(0),
-  mTimestamp(0ll),
-  mDuration(0ll)
+  : mYPlane(aHost)
+  , mUPlane(aHost)
+  , mVPlane(aHost)
+  , mWidth(0)
+  , mHeight(0)
+  , mTimestamp(0ll)
+  , mDuration(0ll)
 {
   MOZ_ASSERT(aHost);
 }
 
-GMPVideoi420FrameImpl::GMPVideoi420FrameImpl(const GMPVideoi420FrameData& aFrameData,
-                                             GMPVideoHostImpl* aHost)
-: mYPlane(aFrameData.mYPlane(), aHost),
-  mUPlane(aFrameData.mUPlane(), aHost),
-  mVPlane(aFrameData.mVPlane(), aHost),
-  mWidth(aFrameData.mWidth()),
-  mHeight(aFrameData.mHeight()),
-  mTimestamp(aFrameData.mTimestamp()),
-  mDuration(aFrameData.mDuration())
+GMPVideoi420FrameImpl::GMPVideoi420FrameImpl(
+  const GMPVideoi420FrameData& aFrameData,
+  GMPVideoHostImpl* aHost)
+  : mYPlane(aFrameData.mYPlane(), aHost)
+  , mUPlane(aFrameData.mUPlane(), aHost)
+  , mVPlane(aFrameData.mVPlane(), aHost)
+  , mWidth(aFrameData.mWidth())
+  , mHeight(aFrameData.mHeight())
+  , mTimestamp(aFrameData.mTimestamp())
+  , mDuration(aFrameData.mDuration())
 {
   MOZ_ASSERT(aHost);
 }
 
-GMPVideoi420FrameImpl::~GMPVideoi420FrameImpl()
-{
-}
+GMPVideoi420FrameImpl::~GMPVideoi420FrameImpl() { }
 
 bool
 GMPVideoi420FrameImpl::InitFrameData(GMPVideoi420FrameData& aFrameData)
 {
   mYPlane.InitPlaneData(aFrameData.mYPlane());
   mUPlane.InitPlaneData(aFrameData.mUPlane());
   mVPlane.InitPlaneData(aFrameData.mVPlane());
   aFrameData.mWidth() = mWidth;
@@ -61,84 +60,104 @@ void
 GMPVideoi420FrameImpl::Destroy()
 {
   delete this;
 }
 
 /* static */ bool
 GMPVideoi420FrameImpl::CheckFrameData(const GMPVideoi420FrameData& aFrameData)
 {
-  // We may be passed the "wrong" shmem (one smaller than the actual size).
-  // This implies a bug or serious error on the child size.  Ignore this frame if so.
-  // Note: Size() greater than expected is also an error, but with no negative consequences
+  // We may be passed the "wrong" shmem (one smaller than the actual size). This
+  // implies a bug or serious error on the child size.  Ignore this frame if so.
+  // Note: Size() greater than expected is also an error, but with no negative
+  // consequences
   int32_t half_width = (aFrameData.mWidth() + 1) / 2;
-  if ((aFrameData.mYPlane().mStride() <= 0) || (aFrameData.mYPlane().mSize() <= 0) ||
-      (aFrameData.mUPlane().mStride() <= 0) || (aFrameData.mUPlane().mSize() <= 0) ||
-      (aFrameData.mVPlane().mStride() <= 0) || (aFrameData.mVPlane().mSize() <= 0) ||
-      (aFrameData.mYPlane().mSize() > (int32_t) aFrameData.mYPlane().mBuffer().Size<uint8_t>()) ||
-      (aFrameData.mUPlane().mSize() > (int32_t) aFrameData.mUPlane().mBuffer().Size<uint8_t>()) ||
-      (aFrameData.mVPlane().mSize() > (int32_t) aFrameData.mVPlane().mBuffer().Size<uint8_t>()) ||
-      (aFrameData.mYPlane().mStride() < aFrameData.mWidth()) ||
-      (aFrameData.mUPlane().mStride() < half_width) ||
-      (aFrameData.mVPlane().mStride() < half_width) ||
-      (aFrameData.mYPlane().mSize() < aFrameData.mYPlane().mStride() * aFrameData.mHeight()) ||
-      (aFrameData.mUPlane().mSize() < aFrameData.mUPlane().mStride() * ((aFrameData.mHeight()+1)/2)) ||
-      (aFrameData.mVPlane().mSize() < aFrameData.mVPlane().mStride() * ((aFrameData.mHeight()+1)/2)))
-  {
+  if ((aFrameData.mYPlane().mStride() <= 0)
+      || (aFrameData.mYPlane().mSize() <= 0)
+      || (aFrameData.mUPlane().mStride() <= 0)
+      || (aFrameData.mUPlane().mSize() <= 0)
+      || (aFrameData.mVPlane().mStride() <= 0)
+      || (aFrameData.mVPlane().mSize() <= 0)
+      || (aFrameData.mYPlane().mSize()
+          > (int32_t)aFrameData.mYPlane().mBuffer().Size<uint8_t>())
+      || (aFrameData.mUPlane().mSize()
+          > (int32_t)aFrameData.mUPlane().mBuffer().Size<uint8_t>())
+      || (aFrameData.mVPlane().mSize()
+          > (int32_t)aFrameData.mVPlane().mBuffer().Size<uint8_t>())
+      || (aFrameData.mYPlane().mStride() < aFrameData.mWidth())
+      || (aFrameData.mUPlane().mStride() < half_width)
+      || (aFrameData.mVPlane().mStride() < half_width)
+      || (aFrameData.mYPlane().mSize()
+          < aFrameData.mYPlane().mStride() * aFrameData.mHeight())
+      || (aFrameData.mUPlane().mSize()
+          < aFrameData.mUPlane().mStride() * ((aFrameData.mHeight() + 1) / 2))
+      || (aFrameData.mVPlane().mSize()
+          < aFrameData.mVPlane().mStride() * ((aFrameData.mHeight() + 1)
+                                              / 2))) {
     return false;
   }
   return true;
 }
 
 bool
-GMPVideoi420FrameImpl::CheckDimensions(int32_t aWidth, int32_t aHeight,
-                                       int32_t aStride_y, int32_t aStride_u, int32_t aStride_v)
+GMPVideoi420FrameImpl::CheckDimensions(int32_t aWidth,
+                                       int32_t aHeight,
+                                       int32_t aStride_y,
+                                       int32_t aStride_u,
+                                       int32_t aStride_v)
 {
   int32_t half_width = (aWidth + 1) / 2;
-  if (aWidth < 1 || aHeight < 1 || aStride_y < aWidth ||
-                                   aStride_u < half_width ||
-                                   aStride_v < half_width) {
+  if (aWidth < 1
+      || aHeight < 1
+      || aStride_y < aWidth
+      || aStride_u < half_width
+      || aStride_v < half_width) {
     return false;
   }
   return true;
 }
 
 const GMPPlaneImpl*
-GMPVideoi420FrameImpl::GetPlane(GMPPlaneType aType) const {
+GMPVideoi420FrameImpl::GetPlane(GMPPlaneType aType) const
+{
   switch (aType) {
     case kGMPYPlane:
       return &mYPlane;
     case kGMPUPlane:
       return &mUPlane;
     case kGMPVPlane:
       return &mVPlane;
     default:
       MOZ_CRASH("Unknown plane type!");
   }
   return nullptr;
 }
 
 GMPPlaneImpl*
-GMPVideoi420FrameImpl::GetPlane(GMPPlaneType aType) {
+GMPVideoi420FrameImpl::GetPlane(GMPPlaneType aType)
+{
   switch (aType) {
     case kGMPYPlane :
       return &mYPlane;
     case kGMPUPlane :
       return &mUPlane;
     case kGMPVPlane :
       return &mVPlane;
     default:
       MOZ_CRASH("Unknown plane type!");
   }
   return nullptr;
 }
 
 GMPErr
-GMPVideoi420FrameImpl::CreateEmptyFrame(int32_t aWidth, int32_t aHeight,
-                                        int32_t aStride_y, int32_t aStride_u, int32_t aStride_v)
+GMPVideoi420FrameImpl::CreateEmptyFrame(int32_t aWidth,
+                                        int32_t aHeight,
+                                        int32_t aStride_y,
+                                        int32_t aStride_u,
+                                        int32_t aStride_v)
 {
   if (!CheckDimensions(aWidth, aHeight, aStride_y, aStride_u, aStride_v)) {
     return GMPGenericErr;
   }
 
   int32_t size_y = aStride_y * aHeight;
   int32_t half_height = (aHeight + 1) / 2;
   int32_t size_u = aStride_u * half_height;
@@ -161,21 +180,27 @@ GMPVideoi420FrameImpl::CreateEmptyFrame(
   mHeight = aHeight;
   mTimestamp = 0ll;
   mDuration = 0ll;
 
   return GMPNoErr;
 }
 
 GMPErr
-GMPVideoi420FrameImpl::CreateFrame(int32_t aSize_y, const uint8_t* aBuffer_y,
-                                   int32_t aSize_u, const uint8_t* aBuffer_u,
-                                   int32_t aSize_v, const uint8_t* aBuffer_v,
-                                   int32_t aWidth, int32_t aHeight,
-                                   int32_t aStride_y, int32_t aStride_u, int32_t aStride_v)
+GMPVideoi420FrameImpl::CreateFrame(int32_t aSize_y,
+                                   const uint8_t* aBuffer_y,
+                                   int32_t aSize_u,
+                                   const uint8_t* aBuffer_u,
+                                   int32_t aSize_v,
+                                   const uint8_t* aBuffer_v,
+                                   int32_t aWidth,
+                                   int32_t aHeight,
+                                   int32_t aStride_y,
+                                   int32_t aStride_u,
+                                   int32_t aStride_v)
 {
   MOZ_ASSERT(aBuffer_y);
   MOZ_ASSERT(aBuffer_u);
   MOZ_ASSERT(aBuffer_v);
 
   if (aSize_y < 1 || aSize_u < 1 || aSize_v < 1) {
     return GMPGenericErr;
   }
--- a/dom/media/gmp/GMPVideoi420FrameImpl.h
+++ b/dom/media/gmp/GMPVideoi420FrameImpl.h
@@ -1,31 +1,32 @@
 /* -*- 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 GMPVideoi420FrameImpl_h_
 #define GMPVideoi420FrameImpl_h_
 
+#include "GMPVideoPlaneImpl.h"
 #include "gmp-video-frame-i420.h"
 #include "mozilla/ipc/Shmem.h"
-#include "GMPVideoPlaneImpl.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPVideoi420FrameData;
 
 class GMPVideoi420FrameImpl : public GMPVideoi420Frame
 {
   friend struct IPC::ParamTraits<mozilla::gmp::GMPVideoi420FrameImpl>;
 public:
   explicit GMPVideoi420FrameImpl(GMPVideoHostImpl* aHost);
-  GMPVideoi420FrameImpl(const GMPVideoi420FrameData& aFrameData, GMPVideoHostImpl* aHost);
+  GMPVideoi420FrameImpl(const GMPVideoi420FrameData& aFrameData,
+                        GMPVideoHostImpl* aHost);
   virtual ~GMPVideoi420FrameImpl();
 
   static bool CheckFrameData(const GMPVideoi420FrameData& aFrameData);
 
   bool InitFrameData(GMPVideoi420FrameData& aFrameData);
   const GMPPlaneImpl* GetPlane(GMPPlaneType aType) const;
   GMPPlaneImpl* GetPlane(GMPPlaneType aType);