Bug 1333915, part 1 - Don't open the channel in CommonInit. r=jimm

The next patch will open the channel differently in each case, so move
that code into the callers.

MozReview-Commit-ID: 4zkLTcoZhUu

--HG--
extra : rebase_source : 65e8bf90a628034914c5526c8efef9e61fc624ab
This commit is contained in:
Andrew McCreight 2017-01-25 16:15:44 -08:00
Родитель 4e878e4834
Коммит b6f21443e2
2 изменённых файлов: 9 добавлений и 15 удалений

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

@ -168,10 +168,8 @@ PluginModuleChild::GetChrome()
return gChromeInstance; return gChromeInstance;
} }
bool void
PluginModuleChild::CommonInit(base::ProcessId aParentPid, PluginModuleChild::CommonInit()
MessageLoop* aIOLoop,
IPC::Channel* aChannel)
{ {
PLUGIN_LOG_DEBUG_METHOD; PLUGIN_LOG_DEBUG_METHOD;
@ -181,15 +179,9 @@ PluginModuleChild::CommonInit(base::ProcessId aParentPid,
// Bug 1090573 - Don't do this for connections to content processes. // Bug 1090573 - Don't do this for connections to content processes.
GetIPCChannel()->SetChannelFlags(MessageChannel::REQUIRE_DEFERRED_MESSAGE_PROTECTION); GetIPCChannel()->SetChannelFlags(MessageChannel::REQUIRE_DEFERRED_MESSAGE_PROTECTION);
if (!Open(aChannel, aParentPid, aIOLoop)) {
return false;
}
memset((void*) &mFunctions, 0, sizeof(mFunctions)); memset((void*) &mFunctions, 0, sizeof(mFunctions));
mFunctions.size = sizeof(mFunctions); mFunctions.size = sizeof(mFunctions);
mFunctions.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; mFunctions.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
return true;
} }
bool bool
@ -197,7 +189,9 @@ PluginModuleChild::InitForContent(base::ProcessId aParentPid,
MessageLoop* aIOLoop, MessageLoop* aIOLoop,
IPC::Channel* aChannel) IPC::Channel* aChannel)
{ {
if (!CommonInit(aParentPid, aIOLoop, aChannel)) { CommonInit();
if (!Open(aChannel, aParentPid, aIOLoop)) {
return false; return false;
} }
@ -277,7 +271,9 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
} }
NS_ASSERTION(mLibrary, "couldn't open shared object"); NS_ASSERTION(mLibrary, "couldn't open shared object");
if (!CommonInit(aParentPid, aIOLoop, aChannel)) { CommonInit();
if (!Open(aChannel, aParentPid, aIOLoop)) {
return false; return false;
} }

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

@ -150,9 +150,7 @@ public:
explicit PluginModuleChild(bool aIsChrome); explicit PluginModuleChild(bool aIsChrome);
virtual ~PluginModuleChild(); virtual ~PluginModuleChild();
bool CommonInit(base::ProcessId aParentPid, void CommonInit();
MessageLoop* aIOLoop,
IPC::Channel* aChannel);
// aPluginFilename is UTF8, not native-charset! // aPluginFilename is UTF8, not native-charset!
bool InitForChrome(const std::string& aPluginFilename, bool InitForChrome(const std::string& aPluginFilename,