Bug 1792474 - Part 2: Remove a couple of unused IPC::Channel members, r=ipc-reviewers,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D158160
This commit is contained in:
Nika Layzell 2022-10-07 01:51:28 +00:00
Родитель cf04808ef0
Коммит 4b0d8ed93e
3 изменённых файлов: 4 добавлений и 34 удалений

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

@ -89,9 +89,6 @@ class Channel {
// Amount of data to read at once from the pipe.
kReadBufferSize = 4 * 1024,
// Maximum size of a message that we allow to be copied (rather than moved).
kMaxCopySize = 32 * 1024,
};
// Initialize a Channel.
@ -138,8 +135,7 @@ class Channel {
int32_t OtherPid() const;
// IsClosed() is 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.
// be out of date.
bool IsClosed() const;
#if defined(OS_POSIX)
@ -147,10 +143,6 @@ class Channel {
// FD # for the client end of the socket and the equivalent FD# to use for
// mapping it into the Child process.
// This method may only be called on the server side of a channel.
//
// If the kTestingChannelID flag is specified on the command line then
// a named FIFO is used as the channel transport mechanism rather than a
// socketpair() in which case this method returns -1 for both parameters.
void GetClientFileDescriptorMapping(int* src_fd, int* dest_fd) const;
// Return the file descriptor for communication with the peer.

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

@ -95,7 +95,6 @@ static int gClientChannelFd =
;
//------------------------------------------------------------------------------
const size_t kMaxPipeNameLength = sizeof(((sockaddr_un*)0)->sun_path);
bool ErrorIsBrokenPipe(int err) { return err == EPIPE || err == ECONNRESET; }
@ -143,8 +142,7 @@ void Channel::SetClientChannelFd(int fd) { gClientChannelFd = fd; }
#endif // defined(MOZ_WIDGET_ANDROID)
Channel::ChannelImpl::ChannelImpl(const ChannelId& channel_id, Mode mode,
Listener* listener)
: factory_(this) {
Listener* listener) {
Init(mode, listener);
if (!CreatePipe(mode)) {
@ -159,8 +157,7 @@ Channel::ChannelImpl::ChannelImpl(const ChannelId& channel_id, Mode mode,
}
Channel::ChannelImpl::ChannelImpl(ChannelHandle pipe, Mode mode,
Listener* listener)
: factory_(this) {
Listener* listener) {
Init(mode, listener);
SetPipe(pipe.release());
@ -205,12 +202,10 @@ void Channel::ChannelImpl::Init(Mode mode, Listener* listener) {
input_buf_offset_ = 0;
input_buf_ = mozilla::MakeUnique<char[]>(Channel::kReadBufferSize);
input_cmsg_buf_ = mozilla::MakeUnique<char[]>(kControlBufferSize);
server_listen_pipe_ = -1;
SetPipe(-1);
client_pipe_ = -1;
listener_ = listener;
waiting_connect_ = true;
processing_incoming_ = false;
closed_ = false;
#if defined(OS_MACOSX)
last_pending_fd_id_ = 0;
@ -219,7 +214,7 @@ void Channel::ChannelImpl::Init(Mode mode, Listener* listener) {
}
bool Channel::ChannelImpl::CreatePipe(Mode mode) {
DCHECK(server_listen_pipe_ == -1 && pipe_ == -1);
DCHECK(pipe_ == -1);
if (mode == MODE_SERVER) {
ChannelHandle server, client;
@ -864,14 +859,6 @@ void Channel::ChannelImpl::Close() {
// Close can be called multiple times, so we need to make sure we're
// idempotent.
// Unregister libevent for the listening socket and close it.
server_listen_connection_watcher_.StopWatchingFileDescriptor();
if (server_listen_pipe_ != -1) {
IGNORE_EINTR(close(server_listen_pipe_));
server_listen_pipe_ = -1;
}
// Unregister libevent for the FIFO and close it.
read_watcher_.StopWatchingFileDescriptor();
write_watcher_.StopWatchingFileDescriptor();

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

@ -90,7 +90,6 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher {
// After accepting one client connection on our server socket we want to
// stop listening.
MessageLoopForIO::FileDescriptorWatcher server_listen_connection_watcher_;
MessageLoopForIO::FileDescriptorWatcher read_watcher_;
MessageLoopForIO::FileDescriptorWatcher write_watcher_;
@ -106,7 +105,6 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher {
};
mozilla::Maybe<PartialWrite> partial_write_;
int server_listen_pipe_;
int pipe_;
int client_pipe_; // The client end of our socketpair().
unsigned pipe_buf_len_; // The SO_SNDBUF value of pipe_, or 0 if unknown.
@ -148,11 +146,6 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher {
// the connect operation in overlapped mode.
bool waiting_connect_;
// This flag is set when processing incoming messages. It is used to
// avoid recursing through ProcessIncomingMessages, which could cause
// problems. TODO(darin): make this unnecessary
bool processing_incoming_;
// This flag is set after we've closed the channel.
std::atomic<bool> closed_;
@ -181,8 +174,6 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher {
mozilla::UniqueMachSendRight other_task_;
#endif
ScopedRunnableMethodFactory<ChannelImpl> factory_;
DISALLOW_COPY_AND_ASSIGN(ChannelImpl);
};