Bug 1156800: Post a task to send async NPP_New result from child to parent; r=jimm

This commit is contained in:
Aaron Klotz
2015-04-27 16:07:28 -06:00
parent 0b5579d9dc
commit c8bcf590a7
3 changed files with 32 additions and 8 deletions

View File

@@ -2177,6 +2177,26 @@ PluginModuleChild::AnswerSyncNPP_New(PPluginInstanceChild* aActor, NPError* rv)
return true;
}
class AsyncNewResultSender : public ChildAsyncCall
{
public:
AsyncNewResultSender(PluginInstanceChild* aInstance, NPError aResult)
: ChildAsyncCall(aInstance, nullptr, nullptr)
, mResult(aResult)
{
}
void Run() override
{
RemoveFromAsyncList();
DebugOnly<bool> sendOk = mInstance->SendAsyncNPP_NewResult(mResult);
MOZ_ASSERT(sendOk);
}
private:
NPError mResult;
};
bool
PluginModuleChild::RecvAsyncNPP_New(PPluginInstanceChild* aActor)
{
@@ -2185,7 +2205,8 @@ PluginModuleChild::RecvAsyncNPP_New(PPluginInstanceChild* aActor)
reinterpret_cast<PluginInstanceChild*>(aActor);
AssertPluginThread();
NPError rv = childInstance->DoNPP_New();
childInstance->SendAsyncNPP_NewResult(rv);
AsyncNewResultSender* task = new AsyncNewResultSender(childInstance, rv);
childInstance->PostChildAsyncCall(task);
return true;
}