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

Unified Diff: ipc/mojo/ipc_mojo_bootstrap.cc

Issue 654113002: ChannelMojo: Fail when GetFileHandleForProcess() failed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 6 years, 2 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/mojo/ipc_mojo_bootstrap.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_mojo_bootstrap.cc
diff --git a/ipc/mojo/ipc_mojo_bootstrap.cc b/ipc/mojo/ipc_mojo_bootstrap.cc
index f45a18ef85d1428e63e2c9f93db395251385cbbd..6a8d0196744d199562d514596d4431fef9bd3d4b 100644
--- a/ipc/mojo/ipc_mojo_bootstrap.cc
+++ b/ipc/mojo/ipc_mojo_bootstrap.cc
@@ -56,7 +56,16 @@ void MojoServerBootstrap::SendClientPipe() {
#endif
client_process_,
true);
- CHECK(client_pipe != IPC::InvalidPlatformFileForTransit());
+ if (client_pipe == IPC::InvalidPlatformFileForTransit()) {
+#if !defined(OS_WIN)
+ // GetFileHandleForProcess() only fails on Windows.
+ NOTREACHED();
+#endif
+ DLOG(WARNING) << "Failed to translate file handle for client process.";
+ Fail();
+ return;
+ }
+
scoped_ptr<Message> message(new Message());
ParamTraits<PlatformFileForTransit>::Write(message.get(), client_pipe);
Send(message.release());
@@ -178,13 +187,18 @@ bool MojoBootstrap::Connect() {
}
void MojoBootstrap::OnBadMessageReceived(const Message& message) {
- delegate_->OnBootstrapError();
+ Fail();
}
void MojoBootstrap::OnChannelError() {
- if (state_ == STATE_READY)
+ if (state_ == STATE_READY || state_ == STATE_ERROR)
return;
DLOG(WARNING) << "Detected error on Mojo bootstrap channel.";
+ Fail();
+}
+
+void MojoBootstrap::Fail() {
+ set_state(STATE_ERROR);
delegate()->OnBootstrapError();
}
« no previous file with comments | « ipc/mojo/ipc_mojo_bootstrap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698