Bug 1333915, part 2 - Stop using bridges and spawns in plugins. r=jimm

The old code would do the content process portion of the open by
immediately sending a message back to the content process, but this
has some weird issues with nesting and priorities. Instead of doing
that, I return the endpoint for the content process back to the
original sync call. This requires more code changes, to thread the
endpoint along, but it is conceptually simpler.

Once I removed the bridges and got it working, I was just able to
remove the spawns from the IPDL file and it worked.

MozReview-Commit-ID: 1tfiJrV4jbV
This commit is contained in:
Andrew McCreight
2017-01-25 14:17:17 -08:00
parent e3f951dfe9
commit 8f66878a7c
11 changed files with 91 additions and 74 deletions

View File

@@ -97,17 +97,11 @@ static GetKeyStatePtr sGetKeyStatePtrStub = nullptr;
#endif
/* static */
PluginModuleChild*
PluginModuleChild::CreateForContentProcess(mozilla::ipc::Transport* aTransport,
base::ProcessId aOtherPid)
bool
PluginModuleChild::CreateForContentProcess(Endpoint<PPluginModuleChild>&& aEndpoint)
{
auto* child = new PluginModuleChild(false);
if (!child->InitForContent(aOtherPid, XRE_GetIOMessageLoop(), aTransport)) {
return nullptr;
}
return child;
return child->InitForContent(Move(aEndpoint));
}
PluginModuleChild::PluginModuleChild(bool aIsChrome)
@@ -185,13 +179,11 @@ PluginModuleChild::CommonInit()
}
bool
PluginModuleChild::InitForContent(base::ProcessId aParentPid,
MessageLoop* aIOLoop,
IPC::Channel* aChannel)
PluginModuleChild::InitForContent(Endpoint<PPluginModuleChild>&& aEndpoint)
{
CommonInit();
if (!Open(aChannel, aParentPid, aIOLoop)) {
if (!aEndpoint.Bind(this)) {
return false;
}
@@ -718,11 +710,13 @@ PluginModuleChild::RecvSetAudioSessionData(const nsID& aId,
#endif
}
PPluginModuleChild*
PluginModuleChild::AllocPPluginModuleChild(mozilla::ipc::Transport* aTransport,
base::ProcessId aOtherPid)
mozilla::ipc::IPCResult
PluginModuleChild::RecvInitPluginModuleChild(Endpoint<PPluginModuleChild>&& aEndpoint)
{
return PluginModuleChild::CreateForContentProcess(aTransport, aOtherPid);
if (!CreateForContentProcess(Move(aEndpoint))) {
return IPC_FAIL(this, "CreateForContentProcess failed");
}
return IPC_OK();
}
PCrashReporterChild*