Bug 1268822 - rename mozilla::gmp::Runnable/SyncRunnable in order not to confuse NS_LOG_ADDREF/NS_LOG_RELEASE. r=rjesup.
authorJW Wang <jwwang@mozilla.com>
Tue, 03 May 2016 10:37:24 +0800
changeset 295770 cd65ab909d3d2ea5342878392355266f73d95439
parent 295769 90382fbdad0061a7f0bc5d182ac750f813fd3d51
child 295771 53d3b7cdb82fe9372dc4b85d51483a94ea97b155
push id76076
push userjwwang@mozilla.com
push dateTue, 03 May 2016 02:53:31 +0000
treeherdermozilla-inbound@cd65ab909d3d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrjesup
bugs1268822
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1268822 - rename mozilla::gmp::Runnable/SyncRunnable in order not to confuse NS_LOG_ADDREF/NS_LOG_RELEASE. r=rjesup.
dom/media/gmp/GMPPlatform.cpp
--- a/dom/media/gmp/GMPPlatform.cpp
+++ b/dom/media/gmp/GMPPlatform.cpp
@@ -19,48 +19,48 @@ static GMPChild* sChild = nullptr;
 
 static bool
 IsOnChildMainThread()
 {
   return sMainLoop && sMainLoop == MessageLoop::current();
 }
 
 // We just need a refcounted wrapper for GMPTask objects.
-class Runnable final
+class GMPRunnable final
 {
 public:
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Runnable)
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPRunnable)
 
-  explicit Runnable(GMPTask* aTask)
+  explicit GMPRunnable(GMPTask* aTask)
   : mTask(aTask)
   {
     MOZ_ASSERT(mTask);
   }
 
   void Run()
   {
     mTask->Run();
     mTask->Destroy();
     mTask = nullptr;
   }
 
 private:
-  ~Runnable()
+  ~GMPRunnable()
   {
   }
 
   GMPTask* mTask;
 };
 
-class SyncRunnable final
+class GMPSyncRunnable final
 {
 public:
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SyncRunnable)
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GMPSyncRunnable)
 
-  SyncRunnable(GMPTask* aTask, MessageLoop* aMessageLoop)
+  GMPSyncRunnable(GMPTask* aTask, MessageLoop* aMessageLoop)
   : mDone(false)
   , mTask(aTask)
   , mMessageLoop(aMessageLoop)
   , mMonitor("GMPSyncRunnable")
   {
     MOZ_ASSERT(mTask);
     MOZ_ASSERT(mMessageLoop);
   }
@@ -68,17 +68,17 @@ public:
   void Post()
   {
     // We assert here for two reasons.
     // 1) Nobody should be blocking the main thread.
     // 2) This prevents deadlocks when doing sync calls to main which if the
     //    main thread tries to do a sync call back to the calling thread.
     MOZ_ASSERT(!IsOnChildMainThread());
 
-    mMessageLoop->PostTask(NewRunnableMethod(this, &SyncRunnable::Run));
+    mMessageLoop->PostTask(NewRunnableMethod(this, &GMPSyncRunnable::Run));
     MonitorAutoLock lock(mMonitor);
     while (!mDone) {
       lock.Wait();
     }
   }
 
   void Run()
   {
@@ -86,17 +86,17 @@ public:
     mTask->Destroy();
     mTask = nullptr;
     MonitorAutoLock lock(mMonitor);
     mDone = true;
     lock.Notify();
   }
 
 private:
-  ~SyncRunnable()
+  ~GMPSyncRunnable()
   {
   }
 
   bool mDone;
   GMPTask* mTask;
   MessageLoop* mMessageLoop;
   Monitor mMonitor;
 };
@@ -115,30 +115,30 @@ CreateThread(GMPThread** aThread)
 
 GMPErr
 RunOnMainThread(GMPTask* aTask)
 {
   if (!aTask || !sMainLoop) {
     return GMPGenericErr;
   }
 
-  RefPtr<Runnable> r = new Runnable(aTask);
-  sMainLoop->PostTask(NewRunnableMethod(r.get(), &Runnable::Run));
+  RefPtr<GMPRunnable> r = new GMPRunnable(aTask);
+  sMainLoop->PostTask(NewRunnableMethod(r.get(), &GMPRunnable::Run));
 
   return GMPNoErr;
 }
 
 GMPErr
 SyncRunOnMainThread(GMPTask* aTask)
 {
   if (!aTask || !sMainLoop || IsOnChildMainThread()) {
     return GMPGenericErr;
   }
 
-  RefPtr<SyncRunnable> r = new SyncRunnable(aTask, sMainLoop);
+  RefPtr<GMPSyncRunnable> r = new GMPSyncRunnable(aTask, sMainLoop);
 
   r->Post();
 
   return GMPNoErr;
 }
 
 GMPErr
 CreateMutex(GMPMutex** aMutex)
@@ -247,19 +247,19 @@ GMPThreadImpl::Post(GMPTask* aTask)
   if (!mThread.IsRunning()) {
     bool started = mThread.Start();
     if (!started) {
       NS_WARNING("Unable to start GMPThread!");
       return;
     }
   }
 
-  RefPtr<Runnable> r = new Runnable(aTask);
+  RefPtr<GMPRunnable> r = new GMPRunnable(aTask);
 
-  mThread.message_loop()->PostTask(NewRunnableMethod(r.get(), &Runnable::Run));
+  mThread.message_loop()->PostTask(NewRunnableMethod(r.get(), &GMPRunnable::Run));
 }
 
 void
 GMPThreadImpl::Join()
 {
   {
     MutexAutoLock lock(mMutex);
     if (mThread.IsRunning()) {