зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1445249 - Part 2 - avoid calling OtherPid() where it might return an invalid pid on android; r=jld
MozReview-Commit-ID: EXio3oNJy4U --HG-- extra : rebase_source : a7fe96470b138bb8758c6b8683ba6ad029adb5a1
This commit is contained in:
Родитель
b5a231f297
Коммит
83b1d64e22
|
@ -596,6 +596,12 @@ IToplevelProtocol::~IToplevelProtocol()
|
|||
|
||||
base::ProcessId
|
||||
IToplevelProtocol::OtherPid() const
|
||||
{
|
||||
return OtherPidMaybeInvalid();
|
||||
}
|
||||
|
||||
base::ProcessId
|
||||
IToplevelProtocol::OtherPidMaybeInvalid() const
|
||||
{
|
||||
return mOtherPid;
|
||||
}
|
||||
|
@ -721,8 +727,19 @@ IToplevelProtocol::CreateSharedMemory(size_t aSize,
|
|||
Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(),
|
||||
segment.get(),
|
||||
id);
|
||||
|
||||
base::ProcessId pid =
|
||||
#ifdef ANDROID
|
||||
// We use OtherPidMaybeInvalid() because on Android this method is actually
|
||||
// called on an unconnected protocol, but Android's shared memory
|
||||
// implementation doesn't actually use the PID.
|
||||
OtherPidMaybeInvalid();
|
||||
#else
|
||||
OtherPid();
|
||||
#endif
|
||||
|
||||
Message* descriptor = shmem.ShareTo(
|
||||
Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), OtherPid(), MSG_ROUTING_CONTROL);
|
||||
Shmem::IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead(), pid, MSG_ROUTING_CONTROL);
|
||||
if (!descriptor) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -432,6 +432,8 @@ protected:
|
|||
GetActorEventTargetInternal(IProtocol* aActor) override;
|
||||
|
||||
private:
|
||||
base::ProcessId OtherPidMaybeInvalid() const;
|
||||
|
||||
ProtocolId mProtocolId;
|
||||
UniquePtr<Transport> mTrans;
|
||||
base::ProcessId mOtherPid;
|
||||
|
|
Загрузка…
Ссылка в новой задаче