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

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

Issue 2227553002: Support mojo connections between unrelated peer processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/system/core.h ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 std::move(platform_handle), 180 std::move(platform_handle),
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(
191 ScopedPlatformHandle pipe_handle) {
192 RequestContext request_context;
193 ports::PortRef port0, port1;
194 GetNodeController()->node()->CreatePortPair(&port0, &port1);
195 MojoHandle handle = AddDispatcher(new MessagePipeDispatcher(
196 GetNodeController(), port0, kUnknownPipeIdForDebug, 0));
197 GetNodeController()->ConnectToPeer(std::move(pipe_handle), port1);
198 return ScopedMessagePipeHandle(MessagePipeHandle(handle));
199 }
200
190 void Core::InitChild(ScopedPlatformHandle platform_handle) { 201 void Core::InitChild(ScopedPlatformHandle platform_handle) {
191 GetNodeController()->ConnectToParent(std::move(platform_handle)); 202 GetNodeController()->ConnectToParent(std::move(platform_handle));
192 } 203 }
193 204
194 void Core::SetMachPortProvider(base::PortProvider* port_provider) { 205 void Core::SetMachPortProvider(base::PortProvider* port_provider) {
195 #if defined(OS_MACOSX) && !defined(OS_IOS) 206 #if defined(OS_MACOSX) && !defined(OS_IOS)
196 GetNodeController()->CreateMachPortRelay(port_provider); 207 GetNodeController()->CreateMachPortRelay(port_provider);
197 #endif 208 #endif
198 } 209 }
199 210
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 std::unique_ptr<NodeController> node_controller) { 1190 std::unique_ptr<NodeController> node_controller) {
1180 // It's OK to leak this reference. At this point we know the IO loop is still 1191 // It's OK to leak this reference. At this point we know the IO loop is still
1181 // running, and we know the NodeController will observe its eventual 1192 // running, and we know the NodeController will observe its eventual
1182 // destruction. This tells the NodeController to delete itself when that 1193 // destruction. This tells the NodeController to delete itself when that
1183 // happens. 1194 // happens.
1184 node_controller.release()->DestroyOnIOThreadShutdown(); 1195 node_controller.release()->DestroyOnIOThreadShutdown();
1185 } 1196 }
1186 1197
1187 } // namespace edk 1198 } // namespace edk
1188 } // namespace mojo 1199 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/core.h ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698