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

Unified Diff: ipc/ipc_channel_mojo.cc

Issue 2301123004: Mojo Channel: Fix deferred proxy dispatch; support paused channels (Closed)
Patch Set: . Created 4 years, 3 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_channel_mojo.h ('k') | ipc/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_mojo.cc
diff --git a/ipc/ipc_channel_mojo.cc b/ipc/ipc_channel_mojo.cc
index 9948e2dbf220348828c7aaf3f934c67e2ff3b372..80bbfb5627d562803885933a417241d70041ca1b 100644
--- a/ipc/ipc_channel_mojo.cc
+++ b/ipc/ipc_channel_mojo.cc
@@ -282,6 +282,14 @@ ChannelMojo::~ChannelMojo() {
}
bool ChannelMojo::Connect() {
+ if (!ConnectPaused())
+ return false;
+
+ Unpause(true);
+ return true;
+}
+
+bool ChannelMojo::ConnectPaused() {
WillConnect();
DCHECK(!task_runner_);
@@ -292,6 +300,22 @@ bool ChannelMojo::Connect() {
return true;
}
+void ChannelMojo::Unpause(bool flush) {
+ bootstrap_->Start();
+
+ // Ensure that no matter what messages have been queued so far, the first
+ // message we send is always the peer PID.
+ DCHECK(message_reader_);
+ message_reader_->sender()->SetPeerPid(GetSelfPID());
+
+ if (flush)
+ Flush();
+}
+
+void ChannelMojo::Flush() {
+ bootstrap_->Flush();
+}
+
void ChannelMojo::Close() {
// NOTE: The MessagePipeReader's destructor may re-enter this function. Use
// caution when changing this method.
@@ -306,7 +330,6 @@ void ChannelMojo::Close() {
// MojoBootstrap::Delegate implementation
void ChannelMojo::OnPipesAvailable(mojom::ChannelAssociatedPtr sender,
mojom::ChannelAssociatedRequest receiver) {
- sender->SetPeerPid(GetSelfPID());
message_reader_.reset(new internal::MessagePipeReader(
pipe_, std::move(sender), std::move(receiver), this));
}
« no previous file with comments | « ipc/ipc_channel_mojo.h ('k') | ipc/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698