Bug 1156861: Add a TaskFactory to PluginProcessParent to handle launch completion tasks; r=jimm

--HG--
extra : source : 29cec4e0a2556ce3a0302ac10606682272b4f2e2
extra : amend_source : 89ae064f64e497974ccff2175292a6784de65a69
This commit is contained in:
Aaron Klotz 2015-05-25 11:53:39 -06:00
Родитель 5b9df4e5b5
Коммит 7582eb7362
2 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -37,6 +37,7 @@ struct RunnableMethodTraits<PluginProcessParent>
PluginProcessParent::PluginProcessParent(const std::string& aPluginFilePath) :
GeckoChildProcessHost(GeckoProcessType_Plugin),
mPluginFilePath(aPluginFilePath),
mTaskFactory(this),
mMainMsgLoop(MessageLoop::current()),
mRunCompleteTaskImmediately(false)
{
@ -215,7 +216,7 @@ PluginProcessParent::OnChannelConnected(int32_t peer_pid)
GeckoChildProcessHost::OnChannelConnected(peer_pid);
if (mLaunchCompleteTask && !mRunCompleteTaskImmediately) {
mLaunchCompleteTask->SetLaunchSucceeded();
mMainMsgLoop->PostTask(FROM_HERE, NewRunnableMethod(this,
mMainMsgLoop->PostTask(FROM_HERE, mTaskFactory.NewRunnableMethod(
&PluginProcessParent::RunLaunchCompleteTask));
}
}
@ -225,7 +226,7 @@ PluginProcessParent::OnChannelError()
{
GeckoChildProcessHost::OnChannelError();
if (mLaunchCompleteTask && !mRunCompleteTaskImmediately) {
mMainMsgLoop->PostTask(FROM_HERE, NewRunnableMethod(this,
mMainMsgLoop->PostTask(FROM_HERE, mTaskFactory.NewRunnableMethod(
&PluginProcessParent::RunLaunchCompleteTask));
}
}

Просмотреть файл

@ -17,6 +17,7 @@
#include "chrome/common/child_process_host.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/plugins/TaskFactory.h"
#include "mozilla/UniquePtr.h"
#include "nsCOMPtr.h"
#include "nsIRunnable.h"
@ -80,6 +81,7 @@ private:
void RunLaunchCompleteTask();
std::string mPluginFilePath;
TaskFactory<PluginProcessParent> mTaskFactory;
UniquePtr<LaunchCompleteTask> mLaunchCompleteTask;
MessageLoop* mMainMsgLoop;
bool mRunCompleteTaskImmediately;