| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/edk/system/node_controller.h" | 5 #include "mojo/edk/system/node_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 { | 363 { |
| 364 base::AutoLock lock(parent_lock_); | 364 base::AutoLock lock(parent_lock_); |
| 365 DCHECK(parent_name_ == ports::kInvalidNodeName); | 365 DCHECK(parent_name_ == ports::kInvalidNodeName); |
| 366 | 366 |
| 367 // At this point we don't know the parent's name, so we can't yet insert it | 367 // At this point we don't know the parent's name, so we can't yet insert it |
| 368 // into our |peers_| map. That will happen as soon as we receive an | 368 // into our |peers_| map. That will happen as soon as we receive an |
| 369 // AcceptChild message from them. | 369 // AcceptChild message from them. |
| 370 bootstrap_parent_channel_ = | 370 bootstrap_parent_channel_ = |
| 371 NodeChannel::Create(this, std::move(platform_handle), io_task_runner_, | 371 NodeChannel::Create(this, std::move(platform_handle), io_task_runner_, |
| 372 ProcessErrorCallback()); | 372 ProcessErrorCallback()); |
| 373 // Prevent the parent pipe handle from being closed on shutdown. Pipe |
| 374 // closure is used by the parent to detect the child process has exited. |
| 375 // Relying on message pipes to be closed is not enough because the parent |
| 376 // may see the message pipe closure before the child is dead, causing the |
| 377 // child process to be unexpectedly SIGKILL'd. |
| 378 bootstrap_parent_channel_->LeakHandleOnShutdown(); |
| 373 } | 379 } |
| 374 bootstrap_parent_channel_->Start(); | 380 bootstrap_parent_channel_->Start(); |
| 375 } | 381 } |
| 376 | 382 |
| 377 scoped_refptr<NodeChannel> NodeController::GetPeerChannel( | 383 scoped_refptr<NodeChannel> NodeController::GetPeerChannel( |
| 378 const ports::NodeName& name) { | 384 const ports::NodeName& name) { |
| 379 base::AutoLock lock(peers_lock_); | 385 base::AutoLock lock(peers_lock_); |
| 380 auto it = peers_.find(name); | 386 auto it = peers_.find(name); |
| 381 if (it == peers_.end()) | 387 if (it == peers_.end()) |
| 382 return nullptr; | 388 return nullptr; |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 shutdown_callback_flag_.Set(false); | 1127 shutdown_callback_flag_.Set(false); |
| 1122 } | 1128 } |
| 1123 | 1129 |
| 1124 DCHECK(!callback.is_null()); | 1130 DCHECK(!callback.is_null()); |
| 1125 | 1131 |
| 1126 callback.Run(); | 1132 callback.Run(); |
| 1127 } | 1133 } |
| 1128 | 1134 |
| 1129 } // namespace edk | 1135 } // namespace edk |
| 1130 } // namespace mojo | 1136 } // namespace mojo |
| OLD | NEW |