mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1119060: Ensure that PluginProcessParent::mLaunchCompleteTask is non-null until the runnable has executed; r=gfritzsche
--HG-- extra : rebase_source : 302721483298af54b2e0f585583150c04e5eba8d
This commit is contained in:
parent
5ffa03e4dd
commit
06315c997f
@ -111,6 +111,22 @@ PluginProcessParent::SetCallRunnableImmediately(bool aCallImmediately)
|
||||
mRunCompleteTaskImmediately = aCallImmediately;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function exists so that we may provide an additional level of
|
||||
* indirection between the task being posted to main event loop (a
|
||||
* RunnableMethod) and the launch complete task itself. This is needed
|
||||
* for cases when both WaitUntilConnected or OnChannel* race to invoke the
|
||||
* task.
|
||||
*/
|
||||
void
|
||||
PluginProcessParent::RunLaunchCompleteTask()
|
||||
{
|
||||
if (mLaunchCompleteTask) {
|
||||
mLaunchCompleteTask->Run();
|
||||
mLaunchCompleteTask = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
PluginProcessParent::WaitUntilConnected(int32_t aTimeoutMs)
|
||||
{
|
||||
@ -119,8 +135,7 @@ PluginProcessParent::WaitUntilConnected(int32_t aTimeoutMs)
|
||||
if (result) {
|
||||
mLaunchCompleteTask->SetLaunchSucceeded();
|
||||
}
|
||||
mLaunchCompleteTask->Run();
|
||||
mLaunchCompleteTask = nullptr;
|
||||
RunLaunchCompleteTask();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -131,7 +146,8 @@ PluginProcessParent::OnChannelConnected(int32_t peer_pid)
|
||||
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
||||
if (mLaunchCompleteTask && !mRunCompleteTaskImmediately) {
|
||||
mLaunchCompleteTask->SetLaunchSucceeded();
|
||||
mMainMsgLoop->PostTask(FROM_HERE, mLaunchCompleteTask.release());
|
||||
mMainMsgLoop->PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&PluginProcessParent::RunLaunchCompleteTask));
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +156,8 @@ PluginProcessParent::OnChannelError()
|
||||
{
|
||||
GeckoChildProcessHost::OnChannelError();
|
||||
if (mLaunchCompleteTask && !mRunCompleteTaskImmediately) {
|
||||
mMainMsgLoop->PostTask(FROM_HERE, mLaunchCompleteTask.release());
|
||||
mMainMsgLoop->PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&PluginProcessParent::RunLaunchCompleteTask));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,8 @@ public:
|
||||
bool IsConnected();
|
||||
|
||||
private:
|
||||
void RunLaunchCompleteTask();
|
||||
|
||||
std::string mPluginFilePath;
|
||||
UniquePtr<LaunchCompleteTask> mLaunchCompleteTask;
|
||||
MessageLoop* mMainMsgLoop;
|
||||
|
Loading…
Reference in New Issue
Block a user