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

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

Issue 2466433002: Add mojo::edk::ClosePeerConnection. (Closed)
Patch Set: Created 4 years, 1 month 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/system/core.h ('k') | mojo/edk/system/node_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/core.h" 5 #include "mojo/edk/system/core.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 child_token, 181 child_token,
182 process_error_callback); 182 process_error_callback);
183 } 183 }
184 184
185 void Core::ChildLaunchFailed(const std::string& child_token) { 185 void Core::ChildLaunchFailed(const std::string& child_token) {
186 RequestContext request_context; 186 RequestContext request_context;
187 GetNodeController()->CloseChildPorts(child_token); 187 GetNodeController()->CloseChildPorts(child_token);
188 } 188 }
189 189
190 ScopedMessagePipeHandle Core::ConnectToPeerProcess( 190 ScopedMessagePipeHandle Core::ConnectToPeerProcess(
191 ScopedPlatformHandle pipe_handle) { 191 ScopedPlatformHandle pipe_handle,
192 const std::string& peer_token) {
192 RequestContext request_context; 193 RequestContext request_context;
193 ports::PortRef port0, port1; 194 ports::PortRef port0, port1;
194 GetNodeController()->node()->CreatePortPair(&port0, &port1); 195 GetNodeController()->node()->CreatePortPair(&port0, &port1);
195 MojoHandle handle = AddDispatcher(new MessagePipeDispatcher( 196 MojoHandle handle = AddDispatcher(new MessagePipeDispatcher(
196 GetNodeController(), port0, kUnknownPipeIdForDebug, 0)); 197 GetNodeController(), port0, kUnknownPipeIdForDebug, 0));
197 GetNodeController()->ConnectToPeer(std::move(pipe_handle), port1); 198 GetNodeController()->ConnectToPeer(std::move(pipe_handle), port1, peer_token);
198 return ScopedMessagePipeHandle(MessagePipeHandle(handle)); 199 return ScopedMessagePipeHandle(MessagePipeHandle(handle));
199 } 200 }
200 201
202 void Core::ClosePeerConnection(const std::string& peer_token) {
203 GetNodeController()->ClosePeerConnection(peer_token);
204 }
205
201 void Core::InitChild(ScopedPlatformHandle platform_handle) { 206 void Core::InitChild(ScopedPlatformHandle platform_handle) {
202 GetNodeController()->ConnectToParent(std::move(platform_handle)); 207 GetNodeController()->ConnectToParent(std::move(platform_handle));
203 } 208 }
204 209
205 void Core::SetMachPortProvider(base::PortProvider* port_provider) { 210 void Core::SetMachPortProvider(base::PortProvider* port_provider) {
206 #if defined(OS_MACOSX) && !defined(OS_IOS) 211 #if defined(OS_MACOSX) && !defined(OS_IOS)
207 GetNodeController()->CreateMachPortRelay(port_provider); 212 GetNodeController()->CreateMachPortRelay(port_provider);
208 #endif 213 #endif
209 } 214 }
210 215
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 std::unique_ptr<NodeController> node_controller) { 1195 std::unique_ptr<NodeController> node_controller) {
1191 // It's OK to leak this reference. At this point we know the IO loop is still 1196 // It's OK to leak this reference. At this point we know the IO loop is still
1192 // running, and we know the NodeController will observe its eventual 1197 // running, and we know the NodeController will observe its eventual
1193 // destruction. This tells the NodeController to delete itself when that 1198 // destruction. This tells the NodeController to delete itself when that
1194 // happens. 1199 // happens.
1195 node_controller.release()->DestroyOnIOThreadShutdown(); 1200 node_controller.release()->DestroyOnIOThreadShutdown();
1196 } 1201 }
1197 1202
1198 } // namespace edk 1203 } // namespace edk
1199 } // namespace mojo 1204 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/core.h ('k') | mojo/edk/system/node_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698