Index: mojo/edk/system/node_controller.cc |
diff --git a/mojo/edk/system/node_controller.cc b/mojo/edk/system/node_controller.cc |
index 4c211acaf708b121f1da2d644fda90e99130beea..7f5d4c389930fcccfa0daa2cda6bd32afe7f32a7 100644 |
--- a/mojo/edk/system/node_controller.cc |
+++ b/mojo/edk/system/node_controller.cc |
@@ -180,6 +180,19 @@ void NodeController::ReservePort(const std::string& token, |
void NodeController::MergePortIntoParent(const std::string& token, |
const ports::PortRef& port) { |
+ { |
+ // This request may be coming from within the process that reserved the |
+ // "parent" side (e.g. for Chrome single-process mode), so if this token is |
+ // reserved locally, merge locally instead. |
+ base::AutoLock lock(reserved_ports_lock_); |
+ auto it = reserved_ports_.find(token); |
+ if (it != reserved_ports_.end()) { |
+ node_->MergePorts(port, name_, it->second.name()); |
+ reserved_ports_.erase(it); |
+ return; |
+ } |
+ } |
+ |
scoped_refptr<NodeChannel> parent = GetParentChannel(); |
if (parent) { |
parent->RequestPortMerge(port.name(), token); |