summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authormorrita <morrita@chromium.org>2014-10-21 17:59:23 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-22 04:03:17 +0000
commit0076bcf1a307e61d32dba4d94e2efa3f2643e3d4 (patch)
treec4398a22bf7e25b876630584d1a363791c1cceb7 /ipc
parentecbafd248eb7a2e5e735482261d14455a3fa61a5 (diff)
downloadchromium_src-0076bcf1a307e61d32dba4d94e2efa3f2643e3d4.zip
chromium_src-0076bcf1a307e61d32dba4d94e2efa3f2643e3d4.tar.gz
chromium_src-0076bcf1a307e61d32dba4d94e2efa3f2643e3d4.tar.bz2
Add a guard in MojoBootstrap::OnClientLaunched()
There is a race where the IO thread got error after the UI thread launched a process. This CL rejects such a case. This is OK as the error is eventually notified to the UI thread. TEST=chromeos browser_tests with ChannelMojo being on. R=viettrungluu@chromium.org BUG=377980 Review URL: https://codereview.chromium.org/671513011 Cr-Commit-Position: refs/heads/master@{#300589}
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mojo/ipc_mojo_bootstrap.cc7
-rw-r--r--ipc/mojo/ipc_mojo_bootstrap.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/ipc/mojo/ipc_mojo_bootstrap.cc b/ipc/mojo/ipc_mojo_bootstrap.cc
index 7233de0..30c33a8 100644
--- a/ipc/mojo/ipc_mojo_bootstrap.cc
+++ b/ipc/mojo/ipc_mojo_bootstrap.cc
@@ -84,6 +84,9 @@ void MojoServerBootstrap::SendClientPipeIfReady() {
}
void MojoServerBootstrap::OnClientLaunched(base::ProcessHandle process) {
+ if (HasFailed())
+ return;
+
DCHECK_EQ(state(), STATE_INITIALIZED);
DCHECK_NE(process, base::kNullProcessHandle);
client_process_ = process;
@@ -202,6 +205,10 @@ void MojoBootstrap::Fail() {
delegate()->OnBootstrapError();
}
+bool MojoBootstrap::HasFailed() const {
+ return state() == STATE_ERROR;
+}
+
bool MojoBootstrap::Send(Message* message) {
return channel_->Send(message);
}
diff --git a/ipc/mojo/ipc_mojo_bootstrap.h b/ipc/mojo/ipc_mojo_bootstrap.h
index 540becf..5f16ef4 100644
--- a/ipc/mojo/ipc_mojo_bootstrap.h
+++ b/ipc/mojo/ipc_mojo_bootstrap.h
@@ -60,6 +60,7 @@ class IPC_MOJO_EXPORT MojoBootstrap : public Listener {
Delegate* delegate() const { return delegate_; }
bool Send(Message* message);
void Fail();
+ bool HasFailed() const;
State state() const { return state_; }
void set_state(State state) { state_ = state; }