зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1156800: Post a task to send async NPP_New result from child to parent; r=jimm
--HG-- extra : rebase_source : ee89159fd7781496aef5fdd55cfe9b610338581d
This commit is contained in:
Родитель
7fb122d0a2
Коммит
d5c84432d0
|
@ -2365,11 +2365,7 @@ PluginInstanceChild::RecvAsyncNPP_NewStream(PBrowserStreamChild* actor,
|
|||
BrowserStreamChild* child = static_cast<BrowserStreamChild*>(actor);
|
||||
NewStreamAsyncCall* task = new NewStreamAsyncCall(this, child, mimeType,
|
||||
seekable);
|
||||
{
|
||||
MutexAutoLock lock(mAsyncCallMutex);
|
||||
mPendingAsyncCalls.AppendElement(task);
|
||||
}
|
||||
MessageLoop::current()->PostTask(FROM_HERE, task);
|
||||
PostChildAsyncCall(task);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3645,12 +3641,17 @@ void
|
|||
PluginInstanceChild::AsyncCall(PluginThreadCallback aFunc, void* aUserData)
|
||||
{
|
||||
ChildAsyncCall* task = new ChildAsyncCall(this, aFunc, aUserData);
|
||||
PostChildAsyncCall(task);
|
||||
}
|
||||
|
||||
void
|
||||
PluginInstanceChild::PostChildAsyncCall(ChildAsyncCall* aTask)
|
||||
{
|
||||
{
|
||||
MutexAutoLock lock(mAsyncCallMutex);
|
||||
mPendingAsyncCalls.AppendElement(task);
|
||||
mPendingAsyncCalls.AppendElement(aTask);
|
||||
}
|
||||
ProcessChild::message_loop()->PostTask(FROM_HERE, task);
|
||||
ProcessChild::message_loop()->PostTask(FROM_HERE, aTask);
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
|
|
|
@ -245,6 +245,8 @@ public:
|
|||
void UnscheduleTimer(uint32_t id);
|
||||
|
||||
void AsyncCall(PluginThreadCallback aFunc, void* aUserData);
|
||||
// This function is a more general version of AsyncCall
|
||||
void PostChildAsyncCall(ChildAsyncCall* aTask);
|
||||
|
||||
int GetQuirks();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче