Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Unified Diff: ipc/ipc_message_pipe_reader.cc

Issue 2173753002: Revert of Support early associated interface binding on ChannelMojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@explicit-channel-ipc-task-runner
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/ipc_message_pipe_reader.h ('k') | ipc/ipc_mojo_bootstrap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_pipe_reader.cc
diff --git a/ipc/ipc_message_pipe_reader.cc b/ipc/ipc_message_pipe_reader.cc
index 8e1b35565bfec09fbabb25835542fbd3e403f627..74c72858fcd179b8389583a85619b3eccb7dab19 100644
--- a/ipc/ipc_message_pipe_reader.cc
+++ b/ipc/ipc_message_pipe_reader.cc
@@ -55,8 +55,10 @@
mojo::MessagePipeHandle pipe,
mojom::ChannelAssociatedPtr sender,
mojo::AssociatedInterfaceRequest<mojom::Channel> receiver,
+ base::ProcessId peer_pid,
MessagePipeReader::Delegate* delegate)
: delegate_(delegate),
+ peer_pid_(peer_pid),
sender_(std::move(sender)),
binding_(this, std::move(receiver)),
sender_interface_id_(sender_.interface_id()),
@@ -121,15 +123,9 @@
sender_->GetAssociatedInterface(name, std::move(request));
}
-void MessagePipeReader::SetPeerPid(int32_t peer_pid) {
- peer_pid_ = peer_pid;
- delegate_->OnPeerPidReceived();
-}
-
void MessagePipeReader::Receive(
mojo::Array<uint8_t> data,
mojo::Array<mojom::SerializedHandlePtr> handles) {
- DCHECK_NE(peer_pid_, base::kNullProcessId);
Message message(
data.size() == 0 ? "" : reinterpret_cast<const char*>(&data[0]),
static_cast<uint32_t>(data.size()));
@@ -160,12 +156,16 @@
void MessagePipeReader::OnPipeError(MojoResult error) {
DCHECK(thread_checker_.CalledOnValidThread());
-
- Close();
-
- // NOTE: The delegate call below may delete |this|.
if (delegate_)
delegate_->OnPipeError();
+ Close();
+}
+
+void MessagePipeReader::DelayedDeleter::operator()(
+ MessagePipeReader* ptr) const {
+ ptr->Close();
+ base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+ base::Bind(&DeleteNow, ptr));
}
} // namespace internal
« no previous file with comments | « ipc/ipc_message_pipe_reader.h ('k') | ipc/ipc_mojo_bootstrap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698