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

Side by Side Diff: mojo/edk/system/node_controller.cc

Issue 1748973003: Revert of Bootstrap Mojo IPC independent of Chrome IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « mojo/edk/embedder/platform_channel_pair.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 DVLOG(2) << "Reserving port " << port.name() << "@" << name_ << " for token " 173 DVLOG(2) << "Reserving port " << port.name() << "@" << name_ << " for token "
174 << token; 174 << token;
175 175
176 base::AutoLock lock(reserved_ports_lock_); 176 base::AutoLock lock(reserved_ports_lock_);
177 auto result = reserved_ports_.insert(std::make_pair(token, port)); 177 auto result = reserved_ports_.insert(std::make_pair(token, port));
178 DCHECK(result.second); 178 DCHECK(result.second);
179 } 179 }
180 180
181 void NodeController::MergePortIntoParent(const std::string& token, 181 void NodeController::MergePortIntoParent(const std::string& token,
182 const ports::PortRef& port) { 182 const ports::PortRef& port) {
183 {
184 // This request may be coming from within the process that reserved the
185 // "parent" side (e.g. for Chrome single-process mode), so if this token is
186 // reserved locally, merge locally instead.
187 base::AutoLock lock(reserved_ports_lock_);
188 auto it = reserved_ports_.find(token);
189 if (it != reserved_ports_.end()) {
190 node_->MergePorts(port, name_, it->second.name());
191 reserved_ports_.erase(it);
192 return;
193 }
194 }
195
196 scoped_refptr<NodeChannel> parent = GetParentChannel(); 183 scoped_refptr<NodeChannel> parent = GetParentChannel();
197 if (parent) { 184 if (parent) {
198 parent->RequestPortMerge(port.name(), token); 185 parent->RequestPortMerge(port.name(), token);
199 return; 186 return;
200 } 187 }
201 188
202 base::AutoLock lock(pending_port_merges_lock_); 189 base::AutoLock lock(pending_port_merges_lock_);
203 pending_port_merges_.push_back(std::make_pair(token, port)); 190 pending_port_merges_.push_back(std::make_pair(token, port));
204 } 191 }
205 192
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 shutdown_callback_.Reset(); 870 shutdown_callback_.Reset();
884 } 871 }
885 872
886 DCHECK(!callback.is_null()); 873 DCHECK(!callback.is_null());
887 874
888 callback.Run(); 875 callback.Run();
889 } 876 }
890 877
891 } // namespace edk 878 } // namespace edk
892 } // namespace mojo 879 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/platform_channel_pair.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698