Bug 1318965 - Removes the custom AtomicRefCount r=cpearce
☠☠ backed out by ee205312f370 ☠ ☠
authorJay Harris <jharris@mozilla.com>
Fri, 16 Dec 2016 11:57:58 +1300
changeset 374310 4bdf65d60c9ec4f086c76554ff3fe5ecc44bd889
parent 374309 c1e2b6c14a7f267c5458e9edab5e86f67a6d073f
child 374311 3f756d8ee4cf3847773ca1ffc6999948f670455b
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1318965
milestone53.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 1318965 - Removes the custom AtomicRefCount r=cpearce MozReview-Commit-ID: BAGocY4nGiM
media/gmp-clearkey/0.1/RefCounted.h
--- a/media/gmp-clearkey/0.1/RefCounted.h
+++ b/media/gmp-clearkey/0.1/RefCounted.h
@@ -16,51 +16,17 @@
 
 #ifndef __RefCount_h__
 #define __RefCount_h__
 
 #include <stdint.h>
 #include <assert.h>
 #include "ClearKeyUtils.h"
 
-#if defined(_MSC_VER)
 #include <atomic>
-typedef std::atomic<uint32_t> AtomicRefCount;
-#else
-class AtomicRefCount {
-public:
-  explicit AtomicRefCount(uint32_t aValue)
-    : mCount(aValue)
-    , mMutex(GMPCreateMutex())
-  {
-    assert(mMutex);
-  }
-  ~AtomicRefCount()
-  {
-    if (mMutex) {
-      mMutex->Destroy();
-    }
-  }
-  uint32_t operator--() {
-    AutoLock lock(mMutex);
-    return --mCount;
-  }
-  uint32_t operator++() {
-    AutoLock lock(mMutex);
-    return ++mCount;
-  }
-  operator uint32_t() {
-    AutoLock lock(mMutex);
-    return mCount;
-  }
-private:
-  uint32_t mCount;
-  GMPMutex* mMutex;
-};
-#endif
 
 // Note: Thread safe.
 class RefCounted {
 public:
   void AddRef() {
     ++mRefCount;
   }
 
@@ -76,17 +42,17 @@ protected:
   RefCounted()
     : mRefCount(0)
   {
   }
   virtual ~RefCounted()
   {
     assert(!mRefCount);
   }
-  AtomicRefCount mRefCount;
+  std::atomic<uint32_t> mRefCount;
 };
 
 template<class T>
 class RefPtr {
 public:
   RefPtr(const RefPtr& src) {
     Set(src.mPtr);
   }