Bug 1157237: Move invocation of async NPP_New to an async task; r=jimm

This commit is contained in:
Aaron Klotz
2015-05-06 01:53:51 -06:00
parent 194e5386d9
commit ccde7a746a

View File

@@ -2200,6 +2200,17 @@ private:
NPError mResult;
};
static void
RunAsyncNPP_New(void* aChildInstance)
{
MOZ_ASSERT(aChildInstance);
PluginInstanceChild* childInstance =
static_cast<PluginInstanceChild*>(aChildInstance);
NPError rv = childInstance->DoNPP_New();
AsyncNewResultSender* task = new AsyncNewResultSender(childInstance, rv);
childInstance->PostChildAsyncCall(task);
}
bool
PluginModuleChild::RecvAsyncNPP_New(PPluginInstanceChild* aActor)
{
@@ -2207,9 +2218,8 @@ PluginModuleChild::RecvAsyncNPP_New(PPluginInstanceChild* aActor)
PluginInstanceChild* childInstance =
reinterpret_cast<PluginInstanceChild*>(aActor);
AssertPluginThread();
NPError rv = childInstance->DoNPP_New();
AsyncNewResultSender* task = new AsyncNewResultSender(childInstance, rv);
childInstance->PostChildAsyncCall(task);
// We don't want to run NPP_New async from within nested calls
childInstance->AsyncCall(&RunAsyncNPP_New, childInstance);
return true;
}