From e4bea0b2ba61b7b0545ee39dc501fb162be1d118 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Wed, 16 Dec 2009 17:27:18 -0500 Subject: [PATCH] Bug 518924 - Implement NPN_AsyncCallback r=cjones --- dom/plugins/PluginModuleChild.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/dom/plugins/PluginModuleChild.cpp b/dom/plugins/PluginModuleChild.cpp index becaf9f5791..c65aab42ec9 100644 --- a/dom/plugins/PluginModuleChild.cpp +++ b/dom/plugins/PluginModuleChild.cpp @@ -1268,14 +1268,35 @@ _poppopupsenabledstate(NPP aNPP) return false; } +class AsyncCallRunnable : public nsRunnable +{ +public: + AsyncCallRunnable(PluginThreadCallback aFunc, void* aUserData) + : mFunc(aFunc) + , mData(aUserData) + { } + + NS_IMETHOD Run() { + mFunc(mData); + return NS_OK; + } + +private: + PluginThreadCallback mFunc; + void* mData; +}; + void NP_CALLBACK _pluginthreadasynccall(NPP aNPP, PluginThreadCallback aFunc, void* aUserData) { _MOZ_LOG(__FUNCTION__); - AssertPluginThread(); - NS_NOTYETIMPLEMENTED("Implement me!"); + if (!aFunc) + return; + + nsCOMPtr e(new AsyncCallRunnable(aFunc, aUserData)); + NS_DispatchToMainThread(e); } NPError NP_CALLBACK