#include "ipc/ipc_sync_channel.h"
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "ipc/ipc_channel_factory.h"
#include "ipc/ipc_logging.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_sync_message.h"
#include "mojo/public/cpp/bindings/sync_event_watcher.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#if !BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#include "ipc/trace_ipc_message.h"
#endif
WaitableEvent;
namespace IPC {
namespace {
void OnEventReady(bool* signal) { … }
ABSL_CONST_INIT thread_local SyncChannel::ReceivedSyncMsgQueue* received_queue = …;
}
class SyncChannel::ReceivedSyncMsgQueue :
public base::RefCountedThreadSafe<ReceivedSyncMsgQueue> { … };
SyncChannel::SyncContext::SyncContext(
Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& listener_task_runner,
WaitableEvent* shutdown_event)
: … { … }
void SyncChannel::SyncContext::OnSendDoneEventSignaled(
base::RunLoop* nested_loop,
base::WaitableEvent* event) { … }
SyncChannel::SyncContext::~SyncContext() { … }
bool SyncChannel::SyncContext::Push(SyncMessage* sync_msg) { … }
bool SyncChannel::SyncContext::Pop() { … }
base::WaitableEvent* SyncChannel::SyncContext::GetSendDoneEvent() { … }
base::WaitableEvent* SyncChannel::SyncContext::GetDispatchEvent() { … }
void SyncChannel::SyncContext::DispatchMessages() { … }
bool SyncChannel::SyncContext::TryToUnblockListener(const Message* msg) { … }
void SyncChannel::SyncContext::Clear() { … }
bool SyncChannel::SyncContext::OnMessageReceived(const Message& msg) { … }
void SyncChannel::SyncContext::OnChannelError() { … }
void SyncChannel::SyncContext::OnChannelOpened() { … }
void SyncChannel::SyncContext::OnChannelClosed() { … }
void SyncChannel::SyncContext::CancelPendingSends() { … }
void SyncChannel::SyncContext::OnShutdownEventSignaled(WaitableEvent* event) { … }
std::unique_ptr<SyncChannel> SyncChannel::Create(
const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& listener_task_runner,
bool create_pipe_now,
base::WaitableEvent* shutdown_event) { … }
std::unique_ptr<SyncChannel> SyncChannel::Create(
Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& listener_task_runner,
WaitableEvent* shutdown_event) { … }
SyncChannel::SyncChannel(
Listener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
const scoped_refptr<base::SingleThreadTaskRunner>& listener_task_runner,
WaitableEvent* shutdown_event)
: … { … }
void SyncChannel::AddListenerTaskRunner(
int32_t routing_id,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { … }
void SyncChannel::RemoveListenerTaskRunner(int32_t routing_id) { … }
SyncChannel::~SyncChannel() = default;
void SyncChannel::SetRestrictDispatchChannelGroup(int group) { … }
scoped_refptr<SyncMessageFilter> SyncChannel::CreateSyncMessageFilter() { … }
bool SyncChannel::Send(Message* message) { … }
void SyncChannel::WaitForReply(mojo::SyncHandleRegistry* registry,
SyncContext* context) { … }
void SyncChannel::OnDispatchEventSignaled(base::WaitableEvent* event) { … }
void SyncChannel::StartWatching() { … }
void SyncChannel::OnChannelInit() { … }
}