Make templated MediaPromise class inherit from ref-counted base

NS_INLINE_DECL_THREADSAFE_REFCOUNTING can't be used with templated classes.
This commit is contained in:
trav90
2017-05-01 04:13:29 -05:00
committed by roytam1
parent 7e58e987fc
commit 645c4f4fdb
+11 -4
View File
@@ -42,9 +42,18 @@ extern PRLogModuleInfo* gMediaPromiseLog;
* When IsExclusive is true, the MediaPromise does a release-mode assertion that
* there is at most one call to either Then(...) or ChainTo(...).
*/
class MediaPromiseBase
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaPromiseBase)
protected:
virtual ~MediaPromiseBase() {}
};
template<typename T> class MediaPromiseHolder;
template<typename ResolveValueT, typename RejectValueT, bool IsExclusive>
class MediaPromise
class MediaPromise : public MediaPromiseBase
{
public:
typedef ResolveValueT ResolveValueType;
@@ -75,8 +84,6 @@ public:
Maybe<RejectValueType> mRejectValue;
};
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaPromise)
protected:
// MediaPromise is the public type, and never constructed directly. Construct
// a MediaPromise::Private, defined below.
@@ -432,7 +439,7 @@ protected:
}
}
~MediaPromise()
virtual ~MediaPromise()
{
PROMISE_LOG("MediaPromise::~MediaPromise [this=%p]", this);
MOZ_ASSERT(!IsPending());