From d3e5a4039d02494508663f84000b5579353b82bc Mon Sep 17 00:00:00 2001 From: Nika Layzell Date: Mon, 7 Jun 2021 22:00:35 +0000 Subject: [PATCH] Bug 1713294 - Use atomics for Unsound_IsClosed and Unsound_NumQueuedMessages, r=ipc-reviewers,mccr8 Differential Revision: https://phabricator.services.mozilla.com/D117039 --- ipc/chromium/src/chrome/common/ipc_channel_posix.h | 5 +++-- ipc/chromium/src/chrome/common/ipc_channel_win.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ipc/chromium/src/chrome/common/ipc_channel_posix.h b/ipc/chromium/src/chrome/common/ipc_channel_posix.h index 0bbe9d008591..536b7b7f5337 100644 --- a/ipc/chromium/src/chrome/common/ipc_channel_posix.h +++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.h @@ -11,6 +11,7 @@ #include // for CMSG macros +#include #include #include #include @@ -139,7 +140,7 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher { bool processing_incoming_; // This flag is set after we've closed the channel. - bool closed_; + std::atomic closed_; // We keep track of the PID of the other side of this channel so that we can // record this when generating logs of IPC messages. @@ -165,7 +166,7 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher { // read output_queue_length_ from any thread (if we're OK getting an // occasional out-of-date or bogus value). We use output_queue_length_ to // implement Unsound_NumQueuedMessages. - size_t output_queue_length_; + std::atomic output_queue_length_; ScopedRunnableMethodFactory factory_; diff --git a/ipc/chromium/src/chrome/common/ipc_channel_win.h b/ipc/chromium/src/chrome/common/ipc_channel_win.h index ac21c16b8ce8..f34af4c5d7ef 100644 --- a/ipc/chromium/src/chrome/common/ipc_channel_win.h +++ b/ipc/chromium/src/chrome/common/ipc_channel_win.h @@ -10,6 +10,7 @@ #include "chrome/common/ipc_channel.h" #include "chrome/common/ipc_message.h" +#include #include #include "base/message_loop.h" @@ -112,7 +113,7 @@ class Channel::ChannelImpl : public MessageLoopForIO::IOHandler { bool processing_incoming_; // This flag is set after Close() is run on the channel. - bool closed_; + std::atomic closed_; // We keep track of the PID of the other side of this channel so that we can // record this when generating logs of IPC messages. @@ -122,7 +123,7 @@ class Channel::ChannelImpl : public MessageLoopForIO::IOHandler { // read output_queue_length_ from any thread (if we're OK getting an // occasional out-of-date or bogus value). We use output_queue_length_ to // implement Unsound_NumQueuedMessages. - size_t output_queue_length_; + std::atomic output_queue_length_; ScopedRunnableMethodFactory factory_;