Bug 1387314-Remove NS_DispatchToMainThread and use nsIEventTarget to dispatch instead. r?cpearce
MozReview-Commit-ID: EcEQlLLhU5z
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -56,16 +56,18 @@ namespace mozilla {
#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
#ifdef __CLASS__
#undef __CLASS__
#endif
#define __CLASS__ "GMPService"
+#define NS_DispatchToMainThread(...) CompileError_UseAbstractMainThreadInstead
+
namespace gmp {
static const uint32_t NodeIdSaltLength = 32;
already_AddRefed<GeckoMediaPluginServiceParent>
GeckoMediaPluginServiceParent::GetSingleton()
{
MOZ_ASSERT(XRE_IsParentProcess());
@@ -1882,18 +1884,20 @@ GMPServiceParent::ActorDestroy(ActorDest
// Dispatch a task to the current thread to ensure we don't delete the
// GMPServiceParent until the current calling context is finished with
// the object.
GMPServiceParent* self = this;
NS_DispatchToCurrentThread(
NS_NewRunnableFunction("gmp::GMPServiceParent::ActorDestroy", [self]() {
// The GMPServiceParent must be destroyed on the main thread.
- NS_DispatchToMainThread(NS_NewRunnableFunction(
- "gmp::GMPServiceParent::ActorDestroy", [self]() { delete self; }));
+ self->mService->mMainThread->Dispatch(
+ NS_NewRunnableFunction(
+ "gmp::GMPServiceParent::ActorDestroy", [self]() { delete self; }),
+ NS_DISPATCH_NORMAL);
}));
}
class OpenPGMPServiceParent : public mozilla::Runnable
{
public:
OpenPGMPServiceParent(GMPServiceParent* aGMPServiceParent,
ipc::Endpoint<PGMPServiceParent>&& aEndpoint,
@@ -1948,8 +1952,10 @@ GMPServiceParent::Create(Endpoint<PGMPSe
// ActorDestroy.
Unused << serviceParent.forget();
return true;
}
} // namespace gmp
} // namespace mozilla
+
+#undef NS_DispatchToMainThread
\ No newline at end of file