зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1706374 - Part 9: Allow reading OtherPid() from an opened IPC::Channel, r=handyman
This will be used to handle pre-opened channels more reliably in ports code. Differential Revision: https://phabricator.services.mozilla.com/D112774
This commit is contained in:
Родитель
56bc256e42
Коммит
1811e3331a
|
@ -12,6 +12,7 @@
|
|||
#include "base/basictypes.h"
|
||||
#include "build/build_config.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "chrome/common/ipc_message.h"
|
||||
|
||||
#ifdef OS_WIN
|
||||
# include <string>
|
||||
|
@ -121,6 +122,10 @@ class Channel {
|
|||
// immediately.
|
||||
bool Send(mozilla::UniquePtr<Message> message);
|
||||
|
||||
// The PID which this channel has been opened with. This will be
|
||||
// `-1` until `OnChannelConnected` has been called.
|
||||
int32_t OtherPid() const;
|
||||
|
||||
// Unsound_IsClosed() and Unsound_NumQueuedMessages() are safe to call from
|
||||
// any thread, but the value returned may be out of date, because we don't
|
||||
// use any synchronization when reading or writing it.
|
||||
|
|
|
@ -965,6 +965,8 @@ void Channel::CloseClientFileDescriptor() {
|
|||
channel_impl_->CloseClientFileDescriptor();
|
||||
}
|
||||
|
||||
int32_t Channel::OtherPid() const { return channel_impl_->OtherPid(); }
|
||||
|
||||
bool Channel::Unsound_IsClosed() const {
|
||||
return channel_impl_->Unsound_IsClosed();
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher {
|
|||
int GetFileDescriptor() const { return pipe_; }
|
||||
void CloseClientFileDescriptor();
|
||||
|
||||
int32_t OtherPid() const { return other_pid_; }
|
||||
|
||||
// See the comment in ipc_channel.h for info on Unsound_IsClosed() and
|
||||
// Unsound_NumQueuedMessages().
|
||||
bool Unsound_IsClosed() const;
|
||||
|
|
|
@ -624,6 +624,8 @@ bool Channel::Send(mozilla::UniquePtr<Message> message) {
|
|||
return channel_impl_->Send(std::move(message));
|
||||
}
|
||||
|
||||
int32_t Channel::OtherPid() const { return channel_impl_->OtherPid(); }
|
||||
|
||||
bool Channel::Unsound_IsClosed() const {
|
||||
return channel_impl_->Unsound_IsClosed();
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ class Channel::ChannelImpl : public MessageLoopForIO::IOHandler {
|
|||
}
|
||||
bool Send(mozilla::UniquePtr<Message> message);
|
||||
|
||||
int32_t OtherPid() const { return other_pid_; }
|
||||
|
||||
// See the comment in ipc_channel.h for info on Unsound_IsClosed() and
|
||||
// Unsound_NumQueuedMessages().
|
||||
bool Unsound_IsClosed() const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче