forked from mirrors/gecko-dev
Bug 1766377 - Fix some sign-compare warnings by using ProcessId more consistently. r=nika,necko-reviewers,kershaw
dom/media/ipc/RDDProcessManager.cpp(320,21): error: comparison of integers of different signs: 'base::ProcessId' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
gpuProcessPid != -1 ? gpuProcessPid : base::GetCurrentProcId();
~~~~~~~~~~~~~ ^ ~~
dom/media/ipc/RDDProcessManager.cpp(332,21): error: comparison of integers of different signs: 'base::ProcessId' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
if (gpuProcessPid != -1) {
~~~~~~~~~~~~~ ^ ~~
gfx/layers/ipc/SharedSurfacesParent.cpp(360,38): error: comparison of integers of different signs: 'base::ProcessId' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
if (!gpm || gpm->GPUProcessPid() != -1) {
~~~~~~~~~~~~~~~~~~~~ ^ ~~
ipc/glue/MessageChannel.cpp(2145,13): error: comparison of integers of different signs: 'int32_t' (aka 'int') and 'const base::ProcessId' (aka 'const unsigned long') [-Werror,-Wsign-compare]
if (pid != base::kInvalidProcessId &&
~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~
Differential Revision: https://phabricator.services.mozilla.com/D144688
This commit is contained in:
parent
490d5e355e
commit
af7d5859d7
24 changed files with 49 additions and 42 deletions
|
|
@ -278,7 +278,7 @@ typename Transaction<Context>::IndexSet Transaction<Context>::Validate(
|
||||||
// from this transaction, so we log the failed values we're going to revert.
|
// from this transaction, so we log the failed values we're going to revert.
|
||||||
MOZ_LOG(Context::GetSyncLog(), LogLevel::Debug,
|
MOZ_LOG(Context::GetSyncLog(), LogLevel::Debug,
|
||||||
("Transaction::PartialRevert(#%" PRIx64 ", pid %d): %s",
|
("Transaction::PartialRevert(#%" PRIx64 ", pid %d): %s",
|
||||||
aOwner->Id(), aSource ? aSource->OtherPid() : -1,
|
aOwner->Id(), aSource ? aSource->OtherPid() : base::kInvalidProcessId,
|
||||||
FormatTransaction<Context>(revertTxn.mModified, mValues,
|
FormatTransaction<Context>(revertTxn.mModified, mValues,
|
||||||
revertTxn.mValues)
|
revertTxn.mValues)
|
||||||
.get()));
|
.get()));
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ RefPtr<GenericNonExclusivePromise> RDDProcessHost::LaunchPromise() {
|
||||||
return mLaunchPromise;
|
return mLaunchPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RDDProcessHost::OnChannelConnected(int32_t peer_pid) {
|
void RDDProcessHost::OnChannelConnected(base::ProcessId peer_pid) {
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
|
|
||||||
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class RDDProcessHost final : public mozilla::ipc::GeckoChildProcessHost {
|
||||||
TimeStamp GetLaunchTime() const { return mLaunchTime; }
|
TimeStamp GetLaunchTime() const { return mLaunchTime; }
|
||||||
|
|
||||||
// Called on the IO thread.
|
// Called on the IO thread.
|
||||||
void OnChannelConnected(int32_t peer_pid) override;
|
void OnChannelConnected(base::ProcessId peer_pid) override;
|
||||||
void OnChannelError() override;
|
void OnChannelError() override;
|
||||||
|
|
||||||
void SetListener(Listener* aListener);
|
void SetListener(Listener* aListener);
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,8 @@ bool RDDProcessManager::CreateVideoBridge() {
|
||||||
ipc::Endpoint<PVideoBridgeChild> childPipe;
|
ipc::Endpoint<PVideoBridgeChild> childPipe;
|
||||||
|
|
||||||
GPUProcessManager* gpuManager = GPUProcessManager::Get();
|
GPUProcessManager* gpuManager = GPUProcessManager::Get();
|
||||||
base::ProcessId gpuProcessPid = gpuManager ? gpuManager->GPUProcessPid() : -1;
|
base::ProcessId gpuProcessPid =
|
||||||
|
gpuManager ? gpuManager->GPUProcessPid() : base::kInvalidProcessId;
|
||||||
|
|
||||||
// Build content device data first; this ensure that the GPU process is fully
|
// Build content device data first; this ensure that the GPU process is fully
|
||||||
// ready.
|
// ready.
|
||||||
|
|
@ -316,8 +317,9 @@ bool RDDProcessManager::CreateVideoBridge() {
|
||||||
// The child end is the producer of video frames; the parent end is the
|
// The child end is the producer of video frames; the parent end is the
|
||||||
// consumer.
|
// consumer.
|
||||||
base::ProcessId childPid = RDDProcessPid();
|
base::ProcessId childPid = RDDProcessPid();
|
||||||
base::ProcessId parentPid =
|
base::ProcessId parentPid = gpuProcessPid != base::kInvalidProcessId
|
||||||
gpuProcessPid != -1 ? gpuProcessPid : base::GetCurrentProcId();
|
? gpuProcessPid
|
||||||
|
: base::GetCurrentProcId();
|
||||||
|
|
||||||
nsresult rv = PVideoBridge::CreateEndpoints(parentPid, childPid, &parentPipe,
|
nsresult rv = PVideoBridge::CreateEndpoints(parentPid, childPid, &parentPipe,
|
||||||
&childPipe);
|
&childPipe);
|
||||||
|
|
@ -329,7 +331,7 @@ bool RDDProcessManager::CreateVideoBridge() {
|
||||||
|
|
||||||
mRDDChild->SendInitVideoBridge(std::move(childPipe),
|
mRDDChild->SendInitVideoBridge(std::move(childPipe),
|
||||||
mNumUnexpectedCrashes == 0, contentDeviceData);
|
mNumUnexpectedCrashes == 0, contentDeviceData);
|
||||||
if (gpuProcessPid != -1) {
|
if (gpuProcessPid != base::kInvalidProcessId) {
|
||||||
gpuManager->InitVideoBridge(std::move(parentPipe));
|
gpuManager->InitVideoBridge(std::move(parentPipe));
|
||||||
} else {
|
} else {
|
||||||
VideoBridgeParent::Open(std::move(parentPipe),
|
VideoBridgeParent::Open(std::move(parentPipe),
|
||||||
|
|
@ -341,7 +343,8 @@ bool RDDProcessManager::CreateVideoBridge() {
|
||||||
|
|
||||||
base::ProcessId RDDProcessManager::RDDProcessPid() {
|
base::ProcessId RDDProcessManager::RDDProcessPid() {
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
base::ProcessId rddPid = mRDDChild ? mRDDChild->OtherPid() : -1;
|
base::ProcessId rddPid =
|
||||||
|
mRDDChild ? mRDDChild->OtherPid() : base::kInvalidProcessId;
|
||||||
return rddPid;
|
return rddPid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ bool GPUProcessHost::WaitForLaunch() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPUProcessHost::OnChannelConnected(int32_t peer_pid) {
|
void GPUProcessHost::OnChannelConnected(base::ProcessId peer_pid) {
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
|
|
||||||
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ class GPUProcessHost final : public mozilla::ipc::GeckoChildProcessHost {
|
||||||
TimeStamp GetLaunchTime() const { return mLaunchTime; }
|
TimeStamp GetLaunchTime() const { return mLaunchTime; }
|
||||||
|
|
||||||
// Called on the IO thread.
|
// Called on the IO thread.
|
||||||
void OnChannelConnected(int32_t peer_pid) override;
|
void OnChannelConnected(base::ProcessId peer_pid) override;
|
||||||
void OnChannelError() override;
|
void OnChannelError() override;
|
||||||
|
|
||||||
void SetListener(Listener* aListener);
|
void SetListener(Listener* aListener);
|
||||||
|
|
|
||||||
|
|
@ -1098,7 +1098,8 @@ bool GPUProcessManager::CreateContentImageBridge(
|
||||||
}
|
}
|
||||||
|
|
||||||
base::ProcessId GPUProcessManager::GPUProcessPid() {
|
base::ProcessId GPUProcessManager::GPUProcessPid() {
|
||||||
base::ProcessId gpuPid = mGPUChild ? mGPUChild->OtherPid() : -1;
|
base::ProcessId gpuPid =
|
||||||
|
mGPUChild ? mGPUChild->OtherPid() : base::kInvalidProcessId;
|
||||||
return gpuPid;
|
return gpuPid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,7 @@ bool SharedSurfacesParent::AccumulateMemoryReport(
|
||||||
SharedSurfacesMemoryReport& aReport) {
|
SharedSurfacesMemoryReport& aReport) {
|
||||||
if (XRE_IsParentProcess()) {
|
if (XRE_IsParentProcess()) {
|
||||||
GPUProcessManager* gpm = GPUProcessManager::Get();
|
GPUProcessManager* gpm = GPUProcessManager::Get();
|
||||||
if (!gpm || gpm->GPUProcessPid() != -1) {
|
if (!gpm || gpm->GPUProcessPid() != base::kInvalidProcessId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (!XRE_IsGPUProcess()) {
|
} else if (!XRE_IsGPUProcess()) {
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ void VRProcessParent::OnChannelError() {
|
||||||
MOZ_ASSERT(false, "VR process channel error.");
|
MOZ_ASSERT(false, "VR process channel error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void VRProcessParent::OnChannelConnected(int32_t peer_pid) {
|
void VRProcessParent::OnChannelConnected(base::ProcessId peer_pid) {
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
|
|
||||||
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class VRProcessParent final : public mozilla::ipc::GeckoChildProcessHost {
|
||||||
bool CanShutdown() override { return true; }
|
bool CanShutdown() override { return true; }
|
||||||
|
|
||||||
void OnChannelError() override;
|
void OnChannelError() override;
|
||||||
void OnChannelConnected(int32_t peer_pid) override;
|
void OnChannelConnected(base::ProcessId peer_pid) override;
|
||||||
void OnChannelConnectedTask();
|
void OnChannelConnectedTask();
|
||||||
void OnChannelErrorTask();
|
void OnChannelErrorTask();
|
||||||
void OnChannelClosed();
|
void OnChannelClosed();
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,8 @@ void ChildProcessHost::ListenerHook::OnMessageReceived(IPC::Message&& msg) {
|
||||||
host_->OnMessageReceived(std::move(msg));
|
host_->OnMessageReceived(std::move(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChildProcessHost::ListenerHook::OnChannelConnected(int32_t peer_pid) {
|
void ChildProcessHost::ListenerHook::OnChannelConnected(
|
||||||
|
base::ProcessId peer_pid) {
|
||||||
host_->opening_channel_ = false;
|
host_->opening_channel_ = false;
|
||||||
host_->OnChannelConnected(peer_pid);
|
host_->OnChannelConnected(peer_pid);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class ChildProcessHost : public IPC::Channel::Listener {
|
||||||
|
|
||||||
// IPC::Channel::Listener implementation:
|
// IPC::Channel::Listener implementation:
|
||||||
virtual void OnMessageReceived(IPC::Message&& msg) override {}
|
virtual void OnMessageReceived(IPC::Message&& msg) override {}
|
||||||
virtual void OnChannelConnected(int32_t peer_pid) override {}
|
virtual void OnChannelConnected(base::ProcessId peer_pid) override {}
|
||||||
virtual void OnChannelError() override {}
|
virtual void OnChannelError() override {}
|
||||||
|
|
||||||
bool opening_channel() { return opening_channel_; }
|
bool opening_channel() { return opening_channel_; }
|
||||||
|
|
@ -57,7 +57,7 @@ class ChildProcessHost : public IPC::Channel::Listener {
|
||||||
public:
|
public:
|
||||||
explicit ListenerHook(ChildProcessHost* host);
|
explicit ListenerHook(ChildProcessHost* host);
|
||||||
virtual void OnMessageReceived(IPC::Message&& msg) override;
|
virtual void OnMessageReceived(IPC::Message&& msg) override;
|
||||||
virtual void OnChannelConnected(int32_t peer_pid) override;
|
virtual void OnChannelConnected(base::ProcessId peer_pid) override;
|
||||||
virtual void OnChannelError() override;
|
virtual void OnChannelError() override;
|
||||||
virtual void GetQueuedMessages(std::queue<IPC::Message>& queue) override;
|
virtual void GetQueuedMessages(std::queue<IPC::Message>& queue) override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
|
#include "base/process.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
#include "mozilla/UniquePtrExtensions.h"
|
#include "mozilla/UniquePtrExtensions.h"
|
||||||
|
|
@ -60,7 +61,7 @@ class Channel {
|
||||||
|
|
||||||
// Called when the channel is connected and we have received the internal
|
// Called when the channel is connected and we have received the internal
|
||||||
// Hello message from the peer.
|
// Hello message from the peer.
|
||||||
virtual void OnChannelConnected(int32_t peer_pid) {}
|
virtual void OnChannelConnected(base::ProcessId peer_pid) {}
|
||||||
|
|
||||||
// Called when an error is detected that causes the channel to close.
|
// Called when an error is detected that causes the channel to close.
|
||||||
// This method is not called when a channel is closed normally.
|
// This method is not called when a channel is closed normally.
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ void AddIPCProfilerMarker(const Message& aMessage, int32_t aOtherPid,
|
||||||
mozilla::ipc::MessagePhase aPhase) {
|
mozilla::ipc::MessagePhase aPhase) {
|
||||||
if (aMessage.routing_id() != MSG_ROUTING_NONE &&
|
if (aMessage.routing_id() != MSG_ROUTING_NONE &&
|
||||||
profiler_feature_active(ProfilerFeature::IPCMessages)) {
|
profiler_feature_active(ProfilerFeature::IPCMessages)) {
|
||||||
if (aOtherPid == -1) {
|
if (aOtherPid == base::kInvalidProcessId) {
|
||||||
DLOG(WARNING) << "Unable to record IPC profile marker, other PID not set";
|
DLOG(WARNING) << "Unable to record IPC profile marker, other PID not set";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1575,7 +1575,7 @@ bool GeckoChildProcessHost::OpenPrivilegedHandle(base::ProcessId aPid) {
|
||||||
return base::OpenPrivilegedProcessHandle(aPid, &mChildProcessHandle);
|
return base::OpenPrivilegedProcessHandle(aPid, &mChildProcessHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeckoChildProcessHost::OnChannelConnected(int32_t peer_pid) {
|
void GeckoChildProcessHost::OnChannelConnected(base::ProcessId peer_pid) {
|
||||||
if (!OpenPrivilegedHandle(peer_pid)) {
|
if (!OpenPrivilegedHandle(peer_pid)) {
|
||||||
MOZ_CRASH("can't open handle to child process");
|
MOZ_CRASH("can't open handle to child process");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ class GeckoChildProcessHost : public ChildProcessHost,
|
||||||
bool SyncLaunch(StringVector aExtraOpts = StringVector(),
|
bool SyncLaunch(StringVector aExtraOpts = StringVector(),
|
||||||
int32_t timeoutMs = 0);
|
int32_t timeoutMs = 0);
|
||||||
|
|
||||||
virtual void OnChannelConnected(int32_t peer_pid) override;
|
virtual void OnChannelConnected(base::ProcessId peer_pid) override;
|
||||||
virtual void OnMessageReceived(IPC::Message&& aMsg) override;
|
virtual void OnMessageReceived(IPC::Message&& aMsg) override;
|
||||||
virtual void OnChannelError() override;
|
virtual void OnChannelError() override;
|
||||||
virtual void GetQueuedMessages(std::queue<IPC::Message>& queue) override;
|
virtual void GetQueuedMessages(std::queue<IPC::Message>& queue) override;
|
||||||
|
|
|
||||||
|
|
@ -2137,7 +2137,7 @@ void MessageChannel::AddProfilerMarker(const IPC::Message& aMessage,
|
||||||
mMonitor->AssertCurrentThreadOwns();
|
mMonitor->AssertCurrentThreadOwns();
|
||||||
|
|
||||||
if (profiler_feature_active(ProfilerFeature::IPCMessages)) {
|
if (profiler_feature_active(ProfilerFeature::IPCMessages)) {
|
||||||
int32_t pid = mListener->OtherPidMaybeInvalid();
|
base::ProcessId pid = mListener->OtherPidMaybeInvalid();
|
||||||
// Only record markers for IPCs with a valid pid.
|
// Only record markers for IPCs with a valid pid.
|
||||||
// And if one of the profiler mutexes is locked on this thread, don't record
|
// And if one of the profiler mutexes is locked on this thread, don't record
|
||||||
// markers, because we don't want to expose profiler IPCs due to the
|
// markers, because we don't want to expose profiler IPCs due to the
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ namespace mozilla::ipc {
|
||||||
|
|
||||||
NodeChannel::NodeChannel(const NodeName& aName,
|
NodeChannel::NodeChannel(const NodeName& aName,
|
||||||
UniquePtr<IPC::Channel> aChannel, Listener* aListener,
|
UniquePtr<IPC::Channel> aChannel, Listener* aListener,
|
||||||
int32_t aPid)
|
base::ProcessId aPid)
|
||||||
: mListener(aListener),
|
: mListener(aListener),
|
||||||
mName(aName),
|
mName(aName),
|
||||||
mOtherPid(aPid),
|
mOtherPid(aPid),
|
||||||
|
|
@ -97,8 +97,8 @@ void NodeChannel::Start(bool aCallConnect) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Check if our channel has already been connected, and knows the other PID.
|
// Check if our channel has already been connected, and knows the other PID.
|
||||||
int32_t otherPid = mChannel->OtherPid();
|
base::ProcessId otherPid = mChannel->OtherPid();
|
||||||
if (otherPid != -1) {
|
if (otherPid != base::kInvalidProcessId) {
|
||||||
SetOtherPid(otherPid);
|
SetOtherPid(otherPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,11 +121,11 @@ void NodeChannel::Close() {
|
||||||
mClosed = true;
|
mClosed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeChannel::SetOtherPid(int32_t aNewPid) {
|
void NodeChannel::SetOtherPid(base::ProcessId aNewPid) {
|
||||||
AssertIOThread();
|
AssertIOThread();
|
||||||
MOZ_ASSERT(aNewPid != -1);
|
MOZ_ASSERT(aNewPid != base::kInvalidProcessId);
|
||||||
|
|
||||||
int32_t previousPid = -1;
|
base::ProcessId previousPid = base::kInvalidProcessId;
|
||||||
if (!mOtherPid.compare_exchange_strong(previousPid, aNewPid)) {
|
if (!mOtherPid.compare_exchange_strong(previousPid, aNewPid)) {
|
||||||
// The PID was already set before this call, double-check that it's correct.
|
// The PID was already set before this call, double-check that it's correct.
|
||||||
MOZ_RELEASE_ASSERT(previousPid == aNewPid,
|
MOZ_RELEASE_ASSERT(previousPid == aNewPid,
|
||||||
|
|
@ -282,7 +282,7 @@ void NodeChannel::OnMessageReceived(IPC::Message&& aMessage) {
|
||||||
OnChannelError();
|
OnChannelError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeChannel::OnChannelConnected(int32_t aPeerPid) {
|
void NodeChannel::OnChannelConnected(base::ProcessId aPeerPid) {
|
||||||
AssertIOThread();
|
AssertIOThread();
|
||||||
|
|
||||||
SetOtherPid(aPeerPid);
|
SetOtherPid(aPeerPid);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "mojo/core/ports/node.h"
|
#include "mojo/core/ports/node.h"
|
||||||
#include "mojo/core/ports/node_delegate.h"
|
#include "mojo/core/ports/node_delegate.h"
|
||||||
|
#include "base/process.h"
|
||||||
#include "chrome/common/ipc_message.h"
|
#include "chrome/common/ipc_message.h"
|
||||||
#include "chrome/common/ipc_channel.h"
|
#include "chrome/common/ipc_channel.h"
|
||||||
#include "mozilla/ipc/ProtocolUtils.h"
|
#include "mozilla/ipc/ProtocolUtils.h"
|
||||||
|
|
@ -37,8 +38,8 @@ class NodeChannel final : public IPC::Channel::Listener {
|
||||||
NodeName mName;
|
NodeName mName;
|
||||||
IPC::Channel::ChannelHandle mHandle;
|
IPC::Channel::ChannelHandle mHandle;
|
||||||
IPC::Channel::Mode mMode;
|
IPC::Channel::Mode mMode;
|
||||||
int32_t mMyPid = -1;
|
base::ProcessId mMyPid = base::kInvalidProcessId;
|
||||||
int32_t mOtherPid = -1;
|
base::ProcessId mOtherPid = base::kInvalidProcessId;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Listener {
|
class Listener {
|
||||||
|
|
@ -62,7 +63,7 @@ class NodeChannel final : public IPC::Channel::Listener {
|
||||||
};
|
};
|
||||||
|
|
||||||
NodeChannel(const NodeName& aName, UniquePtr<IPC::Channel> aChannel,
|
NodeChannel(const NodeName& aName, UniquePtr<IPC::Channel> aChannel,
|
||||||
Listener* aListener, int32_t aPid = -1);
|
Listener* aListener, base::ProcessId aPid = base::kInvalidProcessId);
|
||||||
|
|
||||||
// Send the given message over this peer channel link. May be called from any
|
// Send the given message over this peer channel link. May be called from any
|
||||||
// thread.
|
// thread.
|
||||||
|
|
@ -82,7 +83,7 @@ class NodeChannel final : public IPC::Channel::Listener {
|
||||||
void AcceptInvite(const NodeName& aRealName, const PortName& aInitialPort);
|
void AcceptInvite(const NodeName& aRealName, const PortName& aInitialPort);
|
||||||
|
|
||||||
// The PID of the remote process, once known. May be called from any thread.
|
// The PID of the remote process, once known. May be called from any thread.
|
||||||
int32_t OtherPid() const { return mOtherPid; }
|
base::ProcessId OtherPid() const { return mOtherPid; }
|
||||||
|
|
||||||
// Start communicating with the remote process using this NodeChannel. MUST BE
|
// Start communicating with the remote process using this NodeChannel. MUST BE
|
||||||
// CALLED FROM THE IO THREAD.
|
// CALLED FROM THE IO THREAD.
|
||||||
|
|
@ -109,14 +110,14 @@ class NodeChannel final : public IPC::Channel::Listener {
|
||||||
void FinalDestroy();
|
void FinalDestroy();
|
||||||
|
|
||||||
// Update the known PID for the remote process. IO THREAD ONLY
|
// Update the known PID for the remote process. IO THREAD ONLY
|
||||||
void SetOtherPid(int32_t aNewPid);
|
void SetOtherPid(base::ProcessId aNewPid);
|
||||||
|
|
||||||
void SendMessage(UniquePtr<IPC::Message> aMessage);
|
void SendMessage(UniquePtr<IPC::Message> aMessage);
|
||||||
void DoSendMessage(UniquePtr<IPC::Message> aMessage);
|
void DoSendMessage(UniquePtr<IPC::Message> aMessage);
|
||||||
|
|
||||||
// IPC::Channel::Listener implementation
|
// IPC::Channel::Listener implementation
|
||||||
void OnMessageReceived(IPC::Message&& aMessage) override;
|
void OnMessageReceived(IPC::Message&& aMessage) override;
|
||||||
void OnChannelConnected(int32_t aPeerPid) override;
|
void OnChannelConnected(base::ProcessId aPeerPid) override;
|
||||||
void OnChannelError() override;
|
void OnChannelError() override;
|
||||||
|
|
||||||
// NOTE: This strong reference will create a reference cycle between the
|
// NOTE: This strong reference will create a reference cycle between the
|
||||||
|
|
@ -133,7 +134,7 @@ class NodeChannel final : public IPC::Channel::Listener {
|
||||||
// NOTE: This won't change once the connection has been established, but may
|
// NOTE: This won't change once the connection has been established, but may
|
||||||
// be `-1` until then. This will only be written to on the IO thread, but may
|
// be `-1` until then. This will only be written to on the IO thread, but may
|
||||||
// be read from other threads.
|
// be read from other threads.
|
||||||
std::atomic<int32_t> mOtherPid;
|
std::atomic<base::ProcessId> mOtherPid;
|
||||||
|
|
||||||
// WARNING: This must only be accessed on the IO thread.
|
// WARNING: This must only be accessed on the IO thread.
|
||||||
mozilla::UniquePtr<IPC::Channel> mChannel;
|
mozilla::UniquePtr<IPC::Channel> mChannel;
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ void NodeController::DropPeer(NodeName aNodeName) {
|
||||||
|
|
||||||
NODECONTROLLER_LOG(LogLevel::Info, "Dropping Peer %s (pid: %d)",
|
NODECONTROLLER_LOG(LogLevel::Info, "Dropping Peer %s (pid: %d)",
|
||||||
ToString(aNodeName).c_str(),
|
ToString(aNodeName).c_str(),
|
||||||
channel ? channel->OtherPid() : -1);
|
channel ? channel->OtherPid() : base::kInvalidProcessId);
|
||||||
|
|
||||||
if (channel) {
|
if (channel) {
|
||||||
channel->Close();
|
channel->Close();
|
||||||
|
|
@ -670,7 +670,7 @@ void NodeController::OnRequestIntroduction(const NodeName& aFromNode,
|
||||||
// an invalid introduction to content to clean up any pending outbound
|
// an invalid introduction to content to clean up any pending outbound
|
||||||
// messages.
|
// messages.
|
||||||
NodeChannel::Introduction intro{aName, nullptr, IPC::Channel::MODE_SERVER,
|
NodeChannel::Introduction intro{aName, nullptr, IPC::Channel::MODE_SERVER,
|
||||||
peerA->OtherPid(), -1};
|
peerA->OtherPid(), base::kInvalidProcessId};
|
||||||
peerA->Introduce(std::move(intro));
|
peerA->Introduce(std::move(intro));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ RefPtr<GenericNonExclusivePromise> UtilityProcessHost::LaunchPromise() {
|
||||||
return mLaunchPromise;
|
return mLaunchPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UtilityProcessHost::OnChannelConnected(int32_t peer_pid) {
|
void UtilityProcessHost::OnChannelConnected(base::ProcessId peer_pid) {
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
|
|
||||||
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class UtilityProcessHost final : public mozilla::ipc::GeckoChildProcessHost {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called on the IO thread.
|
// Called on the IO thread.
|
||||||
void OnChannelConnected(int32_t peer_pid) override;
|
void OnChannelConnected(base::ProcessId peer_pid) override;
|
||||||
void OnChannelError() override;
|
void OnChannelError() override;
|
||||||
|
|
||||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ static void HandleErrorAfterDestroy(
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SocketProcessHost::OnChannelConnected(int32_t peer_pid) {
|
void SocketProcessHost::OnChannelConnected(base::ProcessId peer_pid) {
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
|
|
||||||
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
GeckoChildProcessHost::OnChannelConnected(peer_pid);
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ class SocketProcessHost final : public mozilla::ipc::GeckoChildProcessHost {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called on the IO thread.
|
// Called on the IO thread.
|
||||||
void OnChannelConnected(int32_t peer_pid) override;
|
void OnChannelConnected(base::ProcessId peer_pid) override;
|
||||||
void OnChannelError() override;
|
void OnChannelError() override;
|
||||||
|
|
||||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue